public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { selectedType = property.FindPropertyRelative("selectorType"); isInverted = property.FindPropertyRelative("isInverted"); behaviours = property.FindPropertyRelative("behaviours"); tags = property.FindPropertyRelative("TagList"); classID = property.FindPropertyRelative("classList"); varianceID = property.FindPropertyRelative("varianceIDList"); itemID = property.FindPropertyRelative("itemIDList"); components = property.FindPropertyRelative("itemComponents"); Rect invertedRect = new Rect(position.x + 100, position.y, position.width - 80, 16); Rect selectionRect = new Rect(position.x + 20, invertedRect.yMax, position.width - 80, 16); Rect SecondBitRect = new Rect(position.x, selectionRect.yMax, position.width, position.height - 32); EditorGUIUtility.LookLikeControls(); selected = (ItemComponentSetup.SetupByType)selectedType.enumValueIndex; selected = (ItemComponentSetup.SetupByType)EditorGUI.EnumPopup(selectionRect, selected); selectedType.enumValueIndex = (int)selected; isInverted.boolValue = GUI.Toggle(invertedRect, isInverted.boolValue, invertedInfo); var ExtraRows = 0; switch (selected) { case ItemComponentSetup.SetupByType.classID: DrawIntList(SecondBitRect, classID, "Class"); ExtraRows = 1 + classID.arraySize; break; case ItemComponentSetup.SetupByType.tag: DrawTag(SecondBitRect); ExtraRows = 1 + tags.arraySize; break; case ItemComponentSetup.SetupByType.behaviour: DrawBehaviourID(SecondBitRect); ExtraRows = 1 + behaviours.arraySize; break; case ItemComponentSetup.SetupByType.varianceID: DrawIntList(SecondBitRect, varianceID, "Variance"); ExtraRows = 1 + varianceID.arraySize; break; case ItemComponentSetup.SetupByType.itemID: DrawIntList(SecondBitRect, itemID, "Item"); ExtraRows = 1 + itemID.arraySize; break; default: break; } displaySize.height = 16 * (ExtraRows + 3); EditorGUIUtility.LookLikeInspector(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { selectedType = property.FindPropertyRelative("selectorType"); isInverted = property.FindPropertyRelative("isInverted"); behaviours = property.FindPropertyRelative("behaviours"); tags = property.FindPropertyRelative("TagList"); classID = property.FindPropertyRelative("classList"); varianceID = property.FindPropertyRelative("varianceIDList"); itemID = property.FindPropertyRelative("itemIDList"); components = property.FindPropertyRelative("itemComponents"); Rect invertedRect = new Rect(position.x + 100, position.y, position.width - 80, 16); Rect selectionRect = new Rect(position.x + 20, invertedRect.yMax, position.width - 80, 16); Rect SecondBitRect = new Rect(position.x, selectionRect.yMax, position.width, position.height - 32); EditorGUIUtility.LookLikeControls(); selected = (ItemComponentSetup.SetupByType)selectedType.enumValueIndex; selected = (ItemComponentSetup.SetupByType)EditorGUI.EnumPopup(selectionRect, selected); selectedType.enumValueIndex = (int)selected; isInverted.boolValue = GUI.Toggle(invertedRect, isInverted.boolValue, invertedInfo); var ExtraRows = 0; switch (selected) { case ItemComponentSetup.SetupByType.classID: DrawIntList(SecondBitRect, classID, "Class"); ExtraRows = 1 + classID.arraySize; break; case ItemComponentSetup.SetupByType.tag: DrawTag(SecondBitRect); ExtraRows = 1 + tags.arraySize; break; case ItemComponentSetup.SetupByType.behaviour: DrawBehaviourID(SecondBitRect); ExtraRows = 1 + behaviours.arraySize; break; case ItemComponentSetup.SetupByType.varianceID: DrawIntList(SecondBitRect, varianceID,"Variance"); ExtraRows = 1 + varianceID.arraySize; break; case ItemComponentSetup.SetupByType.itemID: DrawIntList(SecondBitRect, itemID, "Item"); ExtraRows = 1 + itemID.arraySize; break; default: break; } displaySize.height = 16 * (ExtraRows + 3); EditorGUIUtility.LookLikeInspector(); }