Quantcast
Channel: Latest Questions by aosome23
Viewing all articles
Browse latest Browse all 64

Custom Editor, variables declared in custom editor script resets

$
0
0
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

Viewing all articles
Browse latest Browse all 64

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>