All of a sudden a FSM i added to a gameobject in my scene is going nuts throwing exceptions every frame. I have already removed the complete FSM to rebuild from scratch, but still it gives me errors. I’ve also updated to the latest version to no avail.
The exception i’m getting is :
NullReferenceException: Object reference not set to an instance of an object
NodeCanvas.StateMachines.FSM.OnGraphUpdate () (at Assets/NodeCanvas/Systems/FSM/FSM.cs:49)
NodeCanvas.MonoManager.Update () (at Assets/NodeCanvas/Core/Other/MonoManager.cs:58)
It appears that the ‘currentState’ object is null.
After fiddling around, at some point it started working again. I removed the involved gameobjects and FSM stuff. After reapplying it all, for some reason it ran like a charm again.
Recently I got the same error. Fortunately it was only a test project. Because this error broke the entire project!
I even could reproduce this error. In my case, I only had to delete the camera game object. Than the exact same error accord. I created a new camera. Didn’t fix the problem. I created a new scene file, with new game objects. It was fine until I only had to create a new FSM. And the same error appeared again. I deleted the entire “Library” folder because I thought some information is broken. But this didn’t help either. I wonder where else Unity may store information. Because obviously something is saved. Is it serialization somewhere else on my drive?
Trying to understand this problem. I just looked up again the “broken” project. And at least in my case, this was indeed the cause. I only added an FSM as a place holder, and of course didn’t add any nodes at all. So, no Start node as well. 😀
You might want to consider to add a more informative error message, Gavalakis. I tried to add an Any State and an Concurrent node, without a Start node of course, and the error showed up again. There is always a Start node required? If so, you might really want to catch this exception and inform the user. Since I could see that one may think, that an Any State or Concurrent node is something that should get the FSM running as well. But it seems it doesn’t.
Such a check was there some time ago and removed for some reason I can’t remember right now 🙂
I’ve just added it in again for the upcomming version 2 so that a log will show up.