Destroyed objects trigger NullReferenceExceptions when loading a scene

NodeCanvas Forums Support Destroyed objects trigger NullReferenceExceptions when loading a scene

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13603
    apalade
    Participant

    Hi there!

    I’m seeing MissingReferenceException’s in FlowCanvas caused by what’s certainly an edge case for you. We apply some funky scene post-processing in our game that destroys a bunch of scene objects before entering play mode and then re-creates them after the the scene is loaded.

    To clarify, we’re using the PostProcessScene attribute.

    More info about the bug:

    • Exception triggered in FlowCanvas\Module\Nodes\Variables\GetVariable.cs at line 67. The blackboard variable’s value has been destroyed but it’s not a true null so the call to GetPrefabType fails.
    • Happens in Node/FlowCanvas 2.8.5 but was seeing it in earlier versions as well
    • Only triggered in the Editor when I have the FlowCanvas Window open.
    • Only happens for Blackboard variables that point to scene objects that are destroyed as part of the scene post processing.

    Full call stack attached. Error is fixed by adding a “fake-null” check in the if statement on line 62.

    I’m on Node/FlowCanvas 2.8.5 and I’m getting NullRefs when I’m in the Editor, I have the FlowCanvas Window open and I start a scene

    Attachments:
    You must be logged in to view attached files.
    #13605
    Gavalakis
    Keymaster

    Hello,

    Ah, I see what is going on. Even if it’s a very special case, it’s nice to have everything cleaned up, so thanks for reporting this 🙂
    If by “fake null” you mean something like that !value.value.Equals(null), then this is what I usually do to make sure that the UnityObject is truly null and what I just added in the GetVariable to avoid this problem.

    Thanks for letting me know.

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

    #13611
    apalade
    Participant

    Yeah, that’s what I meant by “fake null”. I figured it’s a real edge case for you but like you said – it’s nice to have everything tied up.

    Thanks for a great pair of assets by the way! NodeCanvas and FlowCanvas are absolutely crucial for our game and we use them both extensively. I promise to send you an extensive feedback doc once the game is finally out and I have some time. 🙂

    #13626
    Gavalakis
    Keymaster

    Thanks! I am glad you like assets 🙂
    Looking forward to your feedback and of course to see what game you are making with the assets!

    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.