Loosing data when changing scene
Hi!
I have a problem with a custom script editor.
There is an string in the script, which I change from the editor. If I hit play, it all works fine, but when I change the scene in the editor and come back to this scene, the string is not saved. Same happens with float sliders.
All the other values (sprites selected, ints, etc.) works fine, so I don't know whats going on.
In the Editor I have:
showStartImagesScript.nextScene = EditorGUILayout.TextField("Next Scene:", showStartImagesScript.nextScene);
And nextScene is a public string.
I also tried with [SerializeField] but didn't work.
Edit:
Okey, that's what I found now: When I delete the script and Add it again, I can change values, change scene, and it's fine, but I can only do this one time, the next time I change anything, it didn't save.
PD: sry for my english.
Answer by david.ochmann · Apr 16, 2016 at 11:14 AM
I have the same issue. As far as I can tell, no Scene change ist being trigger after setting the field data.
If you force a scene change by moving your GameObject in the hierarchy and then open another scene, you will get a save dialog and your data will be stored.
Your answer
Follow this Question
Related Questions
How to Create a Collapsible Hamburger Menu Icon Custom Inspector/Editor 1 Answer
How to create an Editor for Imported Objects imported from a ScriptedImporter? 1 Answer
Unity Editor Layout Problem 0 Answers
Custom Editor Window - Multiple Selection Dropdown 0 Answers
EditorGUILayout.EnumPopup shows always the same selected option but works as programmed 1 Answer