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?
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)?
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?
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.
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!