When creating a variable in a class that extends Editor, the variables are not serialized and it resets back to the default values. In this case, I want to display a enum in the inspector that is declared in the ExampleEditor script. The values go back to the default after it looses focus. This is what I have so far:
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof (Example))]
public class ExampleEditor : Editor {
private enum Things{
Thing1,
Thing2,
Thing3
}
public ItemTypes currentType;
public override void OnInspectorGUI() {
currentType = (ItemTypes)EditorGUILayout.EnumPopup("Item Type", currentType);
}
}
I understand that you can declare it in the Example script and not it the ExampleEditor script. However, This enum is not needed inside the Example script and I only want it in the Example editor
↧