Reply To: Loosing Game Object reference when performing build (bug?)

FlowCanvas Forums Support Loosing Game Object reference when performing build (bug?) Reply To: Loosing Game Object reference when performing build (bug?)

#1962
Gavalakis
Keymaster

Hello,

Welcome to the forums and thank you. 🙂

The problem you are facing is a typical Unity pitfall, that can easily be missed. What I mean by that, is that by Unity standards and workflow limitation, Assets (like Graph Assets are for example in FlowCanvas), can not have Scene object references and the references will not persist.

Thus, the problem here and the reason why this is happening, is because the flowScript you are using is an Asset reference (instead of a Bound one).

The simplest solution to that Unity limitation, would thus be to convert the flowScript that the FlowScriptController is using into a Bound graph. This can easily be done with the “Bind Graph” button on the FlowScriptController inspector. When a graph is bound, it will become part of the FlowScriptController which exists in the scene and as a result, you will be able to have Scene object references assigned to the graph without any problems.

Another solution if the above is not adequate, would be to use Blackboard Variables and feed those variables to the various graph node inputs instead of directly assigning the references. Because Blackboard, is a component that is attached on the FlowScriptController gameobject and thus lives in the scene as well, it CAN have scene object references as normal.

Please let me know if that clarifies the reasons and whether or not this helps and works for you. 🙂
Thank you!

Join us on Discord: https://discord.gg/97q2Rjh