Loosing Game Object reference when performing build (bug?)

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1958
    pwitham
    Participant

    Hi,

    So I am new to FlowCanvas and therefore this might be me doing something wrong, or it could be a bug?

    Screen 1 shows that I have a Set Active and Set Transform with a Game Object set. When I run everything works out just fine. But when I perform an Android or iOS build, the Game Objects are being set to null as seen in screen 2.

    I have noticed that my Hierarchy is showing an ‘Untitled’ scene and nothing else during the build, after the build, it returns to normal (this may or may not be relevant).

    Thanks for any help or suggestions.

    p.s. great tool.

    Attachments:
    You must be logged in to view attached files.
    #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

    #1963
    pwitham
    Participant

    Thank you so much for the fast and detailed response. The solution worked perfectly, thanks for walking me through it. As I re-read the documention it made sense.

    FlowCanvas is saving me a bunch of time writing out code for simple things, I really am appreciating the time spent on the tool.

    Peter.

    #1979
    Gavalakis
    Keymaster

    Hey Peter,
    You are very welcome and thanks a lot for your positive feedback! I am really glad you like FlowCanvas! 🙂

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.