- Home /
Saving current scene in another scene during gameplay?
I have 2 scenes in separate folders, one has all stuff in it and the other is empty. How during gameplay can I save the contents from the current scene into the other empty scene, so when I close it and reopen it, I can open the scene I saved everything in and have all the saved stuff in it.
I have seen EditorApplication.SaveScene but I've no idea how to use it, plus I'm not really familiar with C#. And does it even work in the built game (.exe or .app)?
Thanks for any answers.
EditorApplication.SaveScene is for saving the scene while working in Unity Editor window only and will not work in your standalone. What you need is something like Unity Serializer which allows you to save the scene while gameplay is in progress.
Just checked out the Unity Serializer, seems pretty good but does it store the saved states so it comes back to them after I close and reopen the standalone?
You need to do it by yourself. Unity serializer will allow you to save and load states. You can use checkpoints for that. But creating checkpoints and saving states needs to be done by you.
Yes but if I close it and reopen it, will the save list still be the same or will it be cleared?
You can have save list to still be the same. You can come and load any checkpoint from that list even after you close and re-open the game. All you need to do is save the list to the disk.
Answer by PommPoirAbricot · Jun 17, 2014 at 12:04 PM
Hello
If you mean to load another scene, you can do it with Application.Load("scenename") Then on each object you want to keep while loading the next scene, use
GameObject.DontDestroyOnLoad(yourGameobject);
Does it help you ?
Thanks for your answer, but I meant, can I save the scene, then come back to it if close and open the actual standalone itself, or close and reopening the editor. Harshad$$anonymous$$ has noted that it doesn't work in that way. Thanks anyway.
Your answer
Follow this Question
Related Questions
AssetDatabase current folder? 2 Answers
What is the difference between Path.GetTempPath() vs Application.temporaryCachePath 0 Answers
How to set and save individual highscores for each scene using serialization? 3 Answers
How can I put a mp3 in the iphone documents folder then load it with www? 1 Answer
editor folder path on Mac 0 Answers