I have created a new inspector which I want to use in combination with a script which is executed during edit mode (using [ExecuteInEditMode]).
The custom inspector is written like this:
This works very well as long as I keep the gameobject selected. As soon as the gameobject looses focus and gets refocused, the rotation is set to 0, the initial value, again. Did I do something wrong, or is it just not possible?
This is because the rotation variable has to be declared on the script derived from Monobehavior and not from the editor script it self. All variables declared in the editor script are "reset" when you deselect the gameobject that has the script derived from Monobehavior.
I would recommend to read the following articles that explain it in more detail: