- Home /
Custom Inspector serializes in 4.6 but not 5?
While writing a custom inspector I started to have a problem where while the inspector didn't lose settings on play, it did lost settings when I switched scenes in editor mode. I decided I to create two separate projects (one in 4.6.9, one in 5.3.5), each with the exact same structure and scripts. I then did things in this order:
Changed the "Hello" variable
Pressed play, then stopped it.
Open the "Main" scene, then open the "Test" scene again.
In 4.6 it keeps the changes while in 5.3 it doesn't.
4.6.9 Example: https://dl.dropboxusercontent.com/u/85846965/ShareX/2016/06/2016-06-17_11-32-20.mp4
5.3.5 Example: https://dl.dropboxusercontent.com/u/85846965/ShareX/2016/06/2016-06-17_11-35-23.mp4
Here are the two scripts used:
Move: http://pastebin.com/SV7pHEgQ
MoveEditor: http://pastebin.com/gRfAMVnE
Answer by chrisall76 · Jun 20, 2016 at 05:43 PM
Found the solution, have to use "EditorSceneManager.MarkSceneDirty" to save the scene once changes are made.
if (GUI.changed) {
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
}