NodeCanvas Forums › Support › Understanding Blackboard Internal Variables Behaviour Save/Load BB › Reply To: Understanding Blackboard Internal Variables Behaviour Save/Load BB
Hello and welcome.
I am glad you like the tools and thanks for the video explanation.
Even though your video and your post was very thorough, I am not exactly sure what you want to achieve ( my bad not able to understand and very sorry about that 🙁 )
Are you trying to save references to the runtime instantiated objects and then load them back, or is the problem only the fact that the internal references array is changing and messing up the original references?
If you are trying to save/load runtime instantiated object references, this is something that is not really possible because these runtime instantiated objects, don’t have anything (some data for example) by which they can be referenced, since they will first need to be instantiated to get a reference to them. Even in “standard” save/load situations in Unity (eg non-NodeCanvas), you wouldn’t store a runtime instanced object reference. You would instead store some other data in basic variable types (like strings or integers) and based on those data instantiate the necessary objects (scene or prefab references) to re-create the state of the game at that time when loading the “save”.
If I indeed misunderstood and the problem is only the fact that the “internal references” array is getting messed up on save/load due to the different object references that have been added in the blackboard in runtime, but you only want to save/load a few of those variables (like for example the integers like Food, Total, Money, Prisoners etc), then one solution would be to separate the data into two Blackboards, one Blackboard being for only the data that you want to save/load and another Blackboard being only for the non-saved static/persistent as well as temporary variables required for your game to work, like for example DiscardSlot, UI, SpawnOrigin, CurrentEventPrefab (if I am not mistaken).
Thinking about this a bit more, I could probably make an update by which to make it possible within a Blackboard to select which variables are to be saved/loaded with a checkbox and which ones to leave untouched.
Did I completely misunderstood your question and the problem you are facing? I am sorry if that is the case.
I don’t know if @zsoik‘s case and solution is relevant, but I think it is a bit of a different situation.
Please let me know.
Thank you!
Join us on Discord: https://discord.gg/97q2Rjh