Topic was automatically imported from the old Question2Answer platform.
i’m trying to mak a game, you can place down stuff
i made it so you can save stuff by basically making a copy of the main scene
issue is, i want all the objects inside to update and use a newer version of the code when loaded (basically update the savefile to the newer game version changes in the script)
to do this i tried to:
-make a new main scene (main also changes so i have to do this)
-make new children based on the old scene and copy the old children’s properties
-change to the new modified main scene
but the problem is the game doesn’t wait for the scene to refresh/change before continuing with the code, making all the new children get added to the old instance and, therefore, getting deleted
To be honest I am not 100% certain I fully understand what you are trying to do here but I think the yield and resume functions will be able to do what you want. Yield basically pauses a function while something happens and resume allows the function to continue. You can see the godot docs here
and this is a good resource to help understand yield.