- Home /
How can i make the scene in my build the same as in my Editor?
Due to some version control issues, i now have a perfectly good build, with all my scenes and scripts in order. However, when i want to work on my scene in the Editor, it's weeks behind. Is there a way to say i want the scene in my build settings, to be the one in my folder, so i can keep on editting it?
This has been solved. There WAS in fact 2 versions of the same scene. One was placed in a prefab folder, the other was in a folder named Scenes. How it happened, i do not know, but i tried copying all data from the working scene to a new scene. Once i was done, i added it to the Build Settings, and saw their paths was different, thats how i found out
I should probably add, that i did manage to get the proper scene in the editor a few hours ago. I assumed everything was all good from there, and pushed to version control and made a local backup.
Suddenly it was back to the wrong scene again, and i dont know if it was after a Unity restart, a build or something else.
Was that just luck or some kind of randomness?? Are you sure theres no way around it??
Answer by Immanuel-Scholz · Apr 21, 2016 at 09:36 AM
This is not easy possible. When the game is built, the scenes are processed and changed and there is no unity-supported way of restoring a .unity file from distributed .asset files.
The (most probably) easiest way is to just bite the bullet and recreate the scene.
If your back is really against a wall and there is a shotgun pointing at you, then there might be a rather complicated way of getting some attributes extracted and re-imported. Basically, you can overwrite DLL's in a built project, so what you could do is to write some script code that gets always executed when the scene loads, (e.g. by hooking into some Awake() of an object in the scene). Then iterate all own gameObjects/settings and write the information you want to some text file.
Finally, write some other editor tooling that reads in the text file and applies it to the scene in the editor.
If you are not firm in scripting and editor scripting, I strongly recommend you just recreate the scene from hand. :(
Holy cow! That's terrible, i'm only a few days from deadline: I should point out, that like an hour ago, i managed to get the correct scene in the editor, and i assumed all was well. But it went back to the wrong scene. I do not know if it was after a Unity restart, test build or whatever. Was that just luck, or maybe randomness?