Saving instantiated object

Erica 2 weeks ago in Game Creator updated by BV123 4 days ago 1

I completely understand the limitation in the save system that means that an object which was instantiated during gameplay won't magically reappear after a save-restore. The restore needs an instance to restore back to, and therefore only objects that exist in the scene can be properly restored.

However, I'm attempting to put together a relatively simple in-game build system, which means that I'm instantiating a lot of wall and floor prefabs (amongst other things). I'm able to record the fact of their instantiation in a list of variables, one list of coordinates for the walls and one list of coordinates for the floors. On scene load, I can then run through these lists and re-instantiate all of the necessary prefabs.

However, I'm wondering if there's some way to make the save system recognize these newly created objects as the same object as existed the first time around, when the game was saved.

For example, let's say the wall prefab had a GC variable hasWindow. I start my game, place one wall, and set its hasWindow boolean to true, then save. That boolean would theoretically be saved somewhere? So when I re-load a scene, restore the state from a save, and spawn a new wall instance based on the list-of-walls variable, can I somehow access that previously saved data and plug it into the new instance of the wall?

Unity version:
Game Creator version:

Not sure if this helps but here's an action on the Game Creator Hub that allows you to Copy Local Variables.

Copy Local Variables