- Home /
Preserve state of objects when stopping game
I am developing a script that randomly generates objects and moves them around. When I play the game, it generates them but I would like to keep them in the editor once I stop the game. Is this possible?
I am instantiating the objects in the "Start" method,, is there a method that I can instantiate while in the editor and preserve each object. Or export everything while in-game, so that I can import them to the editor later?
have you tried pausing? or is that not what you wanted?
Pausing doesn't do the job. The script actually generates a map for me, so I'd like "save" this map to the editor so that I can build on top of it if I close Unity and open it again. The map is only generated when I run the game though, since I am using the "Start" method.
An editor script can do the job, but there is a 'hack' that may do what you need. Run your game in the editor to generate the map. While the game is running, copy the game object with the map, stop the game, past the game object into the hierarchy.
I just tried the copy paste hack, this is close to what I need but I think I will need to develop an editor script since I need them to stay as prefabs, thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220613141907im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Initialising List array for use in a custom Editor 1 Answer
Why do Two Instances of MonoDevelop Open when I double-click a CS file in Inspector? 0 Answers
Instantiate a GameObject multiple times 2 Answers
Audio Clip trouble 2 Answers