- Home /
Enums are not staying set between Editor and MonoBehavior (target) class
Entity Class and EntityEditor Class

I'm using an enumPopup to change the player character type. It was working fine and then it stopped. I made no changes to the code in either class between working and non-working states.
Regardless, when selecting an enum in the Inspector it used to change enums and run the code in the switch statement. Now it just defaults to the first enum (Caster) no matter what I try. I have confirmed that target.characterSelect is being set in EntityEditor. By the time that the Start method runs in Entity, target.characterSelect is set back to the first enum (Caster).
Any ideas where I went wrong?
Answer by Zerot · Mar 26, 2012 at 03:33 PM
Make sure you are calling EditorUtility.SetDirty(target) when something has changed in the inspector gui. You can check for that using GUI.changed.
This fixed it. Don't know how I missed that in the docs. Thanks.
Strange that it worked to begin with...
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
How to provide custom descriptions for EditorGUI.EnumPopup? 1 Answer
Editor window BuildTarget as enum 2 Answers
Drawing Editor Inspector GUI based on selected/current prefab (CustomPropertyDrawer) 2 Answers
Custom Inspector Variables 1 Answer