how to accumulate game objects from the game (runtime) into the current scene?

i want to make a runtime leven editor, so i need to play the game (in the editor), make the level (all the objects will be childs of an empty gameobject (Level) ) , the problem is that when i stop my game, the objects are gone. Is there a way to return from the game and save specific objects?


You need to look into serialization to save the state of the game.
In short:

  • Create objects at runtime
  • Serialize these objects (to the disk, or save the settings for your objects to be able to reconstruct them later)
  • When the game start, load the objects from disk or reconstruct them

You can start with this: Unity - Manual: Script serialization

You could look into my free save & load utility. It is meant to teach users the basics of serialization in relation with Unity and also serves as a base from which you can customize your own save & load system. It is perfectly useable out of the box, though.

SerializeHelper - Free save and load utility. (De)Serialize all objects in your scene.