- Home /
Problem with Save Scene
Hi. I am creating a game where the player can teleport to a new scene. Changes the current scene to a new one (SceneManager.LoadScene (SceneName);). is there any way to save the scene he is leaving? I've seen different methods of doing this, but none of them worked. The method shown on Unity3D (https://docs.unity3d.com/ScriptReference/SceneManagement.EditorSceneManager.SaveScene.html) also doesn't work. Can someone explain to me clearly if the whole scene can be saved at all by going to the second one?
Answer by rh_galaxy · Feb 11, 2021 at 01:06 PM
My answer is that it's hard to do it. When you load the saved* scene again, everything will be reset like it was the first time you loaded it. So it's up to you to set the state of everything back to what it was when you saved it. If it is only a few object positions and not the entire state of the scene, it might go smoothly, but if it requires new or deleted objects it becomes harder. EditorSceneManager.SaveScene() will not work from the game, only in the editor.
Edit:*When you load the scene saved by you, in-game, not in unity editor, I mean. How and what you save is up to you how much info you need to restore a scene the 2nd time you load it.
Edit2: This explains it better https://stackoverflow.com/questions/61204192/save-and-load-entire-scene-in-unity
So despite saving the scene, it still reopens it before saving it, when does it come back? Can I somehow tell him to open a saved scene?
Your answer
Follow this Question
Related Questions
Move objects in scene view before running the game 0 Answers
SerializedObject target has been destroyed. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) 9 Answers
Don't save gameobjects to scene file (No hide flags) 0 Answers
Objects that have been scaled have weird X, Y, Z value in the Scene Editor 2 Answers