Custom editor window data not saving on player script

Hi guys, I’ve made a window to have all my recurrent variables: Camera, player and everything I often use so I dont have to search for it in the hierarchy.

The problem is, when i hit play the script gets the previous value it had and not the actual value that was changed in my custom window.

Please take a look at this screenshot:
http://d.pr/i/Paf6

If i modify the “Dash->Velocidade” in my custom windows the value on the script will change, but when play is hit the value is changed to the previous one. This previous value is truly the previous one and not the prebab default value.

Thanks!

Hi Paulo

If I’m not misunderstanding the problem, try putting this in your OnInspectorGUI code:

if ( GUI.changed )
{
EditorUtility.SetDirty(target);
}
1 Like

Thanks sc3 but that did not worked.

I’ve made a video showing the situation:

http://www.youtube.com/watch?v=8HfrUYfCBlg&hd=1

How can i call some Unity staff in to this thread?

I don’t know if this helps, but you can reset script (right click on script name in inspector). It will reset ALL variables to standard values, like in script. But be careful using it, when you manually change something in inspector (ie. add texture or set up gui skin data), becouse it will also be reset.

I dont think this has something to do with the question, but thanks anyway. Thats 4 days since i posted this question, i’m getting worried…

Having the same issue here. I’ve done tons of custom editor stuff, and it would seem that the last update (3.5.5f3) and the SetDirty isnt affecting serialization…

Are you sure your not setting the values in your player script? if you set the values to a certain value at Start() or another function then this might be the problem?