playMaker

Author Topic: NullReferenceException when making build[SOLVED]  (Read 3978 times)

acknickulous

  • Playmaker Newbie
  • *
  • Posts: 19
NullReferenceException when making build[SOLVED]
« on: April 26, 2018, 02:29:46 AM »
So I'm updating an old 5.5.2 project to 5.6.5p1 and I've updated PlayMaker to the latest version. It runs fine in the editor, but when I try to do a PC/Mac build on my Mac I get this error coming from the build process:

NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.Actions.Trigger2dEvent.OnPreprocess () (at Assets/PlayMaker Unity 2D/Actions/Trigger2dEvent.cs:42)
HutongGames.PlayMaker.Fsm.Preprocess () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1610)
HutongGames.PlayMaker.Fsm.Preprocess (UnityEngine.MonoBehaviour component) (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1597)
PlayMakerFSM.Preprocess () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:232)
HutongGames.PlayMakerEditor.PlayMakerBuildCallbacks.OnPostprocessScene () (at C:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Editor/PlayMakerBuildCallbacks.cs:34)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnProcessScene (Scene scene) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:70)
UnityEditor.Build.BuildPipelineInterfaces.OnSceneProcess (Scene scene, Boolean strict) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:253)
UnityEditor.HostView:OnGUI()


Any idea on how to fix this? I've looked into similar error messages here and it's not an iTween conflict or anything else. Could it possibly be some old files from the previous version of PlayMaker hanging around?
« Last Edit: June 30, 2018, 12:17:46 PM by djaydino »

KoneJone

  • Playmaker Newbie
  • *
  • Posts: 20
    • Planet Jone
Re: NullReferenceException when making build
« Reply #1 on: June 27, 2018, 01:29:45 PM »
I'm dealing with the same issue: I just got back to my project after 1,5 years of deliberation, and am updating from Unity 5.3.5 to Unity 5.6.6, and from Playmaker 1.8.1 to 1.9.0p2.

I managed to fix other problems, but that same NullReferenceException haunts me. It seems that my game runs fine in the Editor when I make a Windows standalone build, but WebGL and Android builds have trouble with handling trigger enter events, maybe due to this error.

Ideas?

verybinary

  • Junior Playmaker
  • **
  • Posts: 81
    • The Museum of Digital
Re: NullReferenceException when making build
« Reply #2 on: June 27, 2018, 01:53:06 PM »
are you using the trigger 2d event?
if not, delete it.
if so...
 - whats line 42 of the script?
 - can you change that/those fsms to use the non-2d variants?
 - have you saved your project, closed unity completely(reboot couldn't hurt) and open again for a fresh try?
 - can you build an exe with the old version of playmaker you were using?

Apart from that, knowing what I know about your project, I cant be of much more help. when I updated old projects, I ended up redoing it from the ground up. my playmaker foo has gotten better over the years, and my old projects were ugly and inefficient. is redoing it an option? probably not. just throwing it out there.
is there a "correct way to update the engine and playmaker at the same time that neither of us know yet?
could you drag back in the old trigger 2d script into the new playmaker?
ummm...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: NullReferenceException when making build
« Reply #3 on: June 27, 2018, 06:30:18 PM »
Hi.
Do you have some custom actions/packages from the Ecosystem?

If so try to update them
also update : PlayMaker Utils

Also some packages from the Ecosystem are now included with playmaker (a few versions back like Physics2D and i think animator)
So you might need to remove these folders inside the 'playmaker custom action' folder (if they exist)

But before you do MAKE A BACKUP from you project :)

KoneJone

  • Playmaker Newbie
  • *
  • Posts: 20
    • Planet Jone
Re: NullReferenceException when making build
« Reply #4 on: June 29, 2018, 08:22:57 AM »
Thank you both for your ideas! Following them, and tinkering for a while (and going mad sporadically), I eventually did as much a clean install I could:

1. Created a clean new project in Unity 5.6.6, then installed the newest Playmaker 1.9.0p2 from the Asset Store + the same for Ecosystem
2. Then, one by one, manually, moved my other addons (and their .metas) from the old project to the clean project, checking after each move that everything was still working expected by relaunching Unity after each move I made
3. Then, brought in my actual project files (scenes, prefabs, etc.) and their metas in the same way
4. Then, installed any custom actions from the Ecosystem that were now missing
5. Then, deleted each old addon I had one by one and installed the newest versions from the Asset Store (also one by one, relaunching Unity after each change)
6. Fixed all the little things that came up with the new versions of the addons

End result: everything is now working as intended and there's no NullRefenceException errors anymore.

Needless to say, I backed up the project after each move I made, so it took a sweet while to do all this, but at least I didn't accidentally destroy anything forever and can now continue the actual development. (Well, I guess I'm gonna try to update to Unity 2017 and 2018 before that, but that's gonna be another story.)

What was nice about this spring cleaning that I also got rid of old legacy scrap from Playmakers before 1.8.1, and custom actions and packages I didn't actually use anywhere.
« Last Edit: June 29, 2018, 08:24:42 AM by KoneJone »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: NullReferenceException when making build
« Reply #5 on: June 30, 2018, 12:17:31 PM »
Hi.
I am happy that you got everything to work.

I hate spring cleaning...

But it's also good to do that, also inside your fsms it's good to look how you could do some things different with less states. :)

And also naming and description updates :)