private void InteractableGUI() { serializedObject.Update(); float width = EditorGUIUtility.currentViewWidth / 3f; EditorGUILayout.BeginHorizontal(); int conditionIndex = AllConditionsEditor.GetConditionIndex(condition); if (conditionIndex == -1) { conditionIndex = 0; } conditionIndex = EditorGUILayout.Popup(conditionIndex, AllConditionsEditor.AllConditionDescriptions, GUILayout.Width(width)); Condition globalCondition = AllConditionsEditor.GetConditionAt(conditionIndex); descriptionProperty.stringValue = globalCondition != null ? globalCondition.description : blankDescription; hashProperty.intValue = Animator.StringToHash(descriptionProperty.stringValue); //satisfaction toggle EditorGUILayout.PropertyField(satisfiedProperty, GUIContent.none, GUILayout.Width(width + toggleOffset)); if (GUILayout.Button("-", GUILayout.Width(conditionButtonWidth))) { conditionsProperty.RemoveFromObjectArray(condition); } EditorGUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); }
protected override void DrawReaction() { if (conditionProperty.objectReferenceValue == null) { conditionProperty.objectReferenceValue = AllConditionsEditor.GetConditionAt(0); } int index = AllConditionsEditor.GetConditionIndex((Condition)conditionProperty.objectReferenceValue); index = EditorGUILayout.Popup(index, AllConditionsEditor.AllConditionDescriptions); conditionProperty.objectReferenceValue = AllConditionsEditor.GetConditionAt(index); EditorGUILayout.PropertyField(satisfiedProperty); }