|
Hey guys, 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?
(comments are locked)
|
|
Hi DrahtMaul, 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: http://docs.unity3d.com/Documentation/Components/gui-ExtendingEditor.html http://active.tutsplus.com/tutorials/workflow/how-to-add-your-own-tools-to-unitys-editor/ Yeah, I figured that out myself already, I just forgot to say that here. I'm sorry about that. Thank you for the links anyways!
Aug 03 '12 at 09:43 PM
DrahtMaul
(comments are locked)
|
