Only one DoNotDestroyOnLoad blackboard on scene change?

FlowCanvas Forums Support Only one DoNotDestroyOnLoad blackboard on scene change?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2634
    elvisish
    Participant

    I’m using a couple of global blackboards with DoNotDestroyOnLoad checked so the variables are persistent between scenes. Since I need these global blackboard objects in each scene when I’m testing each scene, whenever there’s a scene change or scene reload, the global blackboards have multiples of themselves. Is there a way of making the DoNotDestroyOnLoad version of the global object destroy the duplicate when the scene changes or reloads?

    #2639
    Gavalakis
    Keymaster

    Hello again 🙂

    If a Global Blackboard with the same identifier name exists, the preview Global Blackboard should destroy itself (this is how it already works now). Please note however, that only the component itself is destroyed and *not* the gameobject. Is that what you mean, or is it that the component is not destroyed at all (ensure the identifier names are also the same)?

    Please let me know.

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

    #2641
    elvisish
    Participant

    Ahh yes, the gameobject isn’t being destroyed and it was causing an issue with the reference, but I don’t recall the blackboard being destroyed either. Another option I guess would be to create the global blackboard gameobject if it doesn’t already exist (and not if it does, ie: in DoNotDestroyOnLoad), would that be the usual practice to ensure only one global blackboard gameobject exists at all times, through every scene? Or is there another way so each scene can still have the object in for testing, but never duplicate on scene change/reload?

    #2654
    Gavalakis
    Keymaster

    Hello again 🙂

    Can you please confirm whether or not the actual Global Blackboard component is destroyed or not? The reason why the gameobject is not destroyed is because some people prefer to have multiple GlobalBlackboard components (or even other components) on the same gameobject. Thus if the gameobject was to be destroyed entirely, that would actually destroy all GlobalBlackboards (and other components) attached to it. This is why only the component is destroyed 🙂

    Does the fact that the actual gameobject is still alive an issue for you? If so, I may add an option to choose either to destroy the component only (like now), or the gameobject entirely.

    Let me know.

    Thanks!

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

    #2657
    elvisish
    Participant

    Seems to be fine now, maybe after the fix for the order of execution? It does indeed delete the global blackboard on the object in the scene, it might be useful to have the option of destroying the entire object though, for tidiness and in case Get Object By Tags are somehow used. Thanks!

    #2662
    Gavalakis
    Keymaster

    Hello again 🙂
    I have now added such an option and will be there in the next version update 🙂
    Thanks!

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

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