Search Unity

Saving values set in editor mode

Discussion in 'Editor & General Support' started by Marsa-Palas, May 25, 2015.

  1. Marsa-Palas

    Marsa-Palas

    Joined:
    Mar 4, 2015
    Posts:
    8
    I made an asset which can draw a path in the scene. I used a custom editor to add new components of the path and to change a shape. And it works fine in the editor mode - I make a path as I want, save the scene and project just to be sure, and go into play mode.

    Problem is when I get out of play mode back into edit mode, my path loses it's shape, so all parts look as they were just initialized.

    So, how to preserve positions i've set in edit mode?
    I could save them in some file, but is that the right thing to do? I've tried to add this code in OnInspectorGUI function, but it still acts the same.
    Code (CSharp):
    1. if(GUI.changed)
    2. {
    3.     EditorUtility.SetDirty(_target);
    4. }