I select FSM Game Owner object. In this FSM, I have a button clicked condition. While it is not playing I set button from a scene game object. I save the scene. I play and stop on the editor. Button reference becomes None.
Hmm.. That’s very weird.
Are both FSMOwner and Button gameobjects, scene hierarchy objects, or is FSMOwner a prefab by any chance?
What version of NodeCanvas are you using by the way?
This happens because the fsm is an asset reference. Assets (like an asset graph) can’t have scene object references.
This is generally a Unity “thing” and how Unity works though rather that a NodeCanvas specific issue.
The workaround to make it possible to use scene object references when using asset graphs, is to do so through the blackboard variables.
Because Blackboard is a component that lives on the gameobject which is in the scene (unless it is a prefab), it CAN have scene object references, but scene object references directly assigned to the asset graph object fields, will not work.
The other way around (if possible), would of course simply be to use bound graphs instead, but depending on the situation (eg reused graph asset) it might not always be desirable and in which case Blackboard variables are the way to go.
Let me know if that explains why it’s happening and if that works for you.
Thank you.