Godot Version
4.4
Question
Hi, having an issue with packed scenes resetting to default values when a level is reloaded - for example the player enters a building, the scene changes, then the player goes back outside - but a bunch of things arent working anymore. Closer inspection reveals that the @export variables are reset to default values for the child scenes, i.e. NPC name. Could this be the sign of a memory leak? Any ideas?
I found out that i didnt reset a variable that was saved from the other scene. Is there a good way of tracking down these errors ?
Using version control software should highlight strange unexpected file changes as well as provide a method of recovery.
The memory leak is still there, i found some mis-typed save commands, the same item flag referenced twice, probably from copying and pasting …
Objects are losing their persistence and defaulting to the PackedScene file configuration. I found that this happens when the code hops to a different scope.
There were actually two problems … one with the flags however the object persistence was apparently not the same issue. I thought maybe the memory was mis-aligned and overflowing on reload.
Finally realized …
The packed scene export variables referenced nodes that were children of the packed scene in the level - they dont get instantiated until after the parent node. I moved them up above to be sibling nodes instead.