private UnityEditor.Animations.AnimatorController GenerateAnimatorController() { // Prepare the triggers list List <string> triggers = new List <string>(); triggers.Add((!string.IsNullOrEmpty(this.m_NormalTriggerProperty.stringValue)) ? this.m_NormalTriggerProperty.stringValue : "Normal"); return(UIAnimatorControllerGenerator.GenerateAnimatorContoller(triggers, this.m_TargetGameObjectProperty.objectReferenceValue.name)); }
protected UnityEditor.Animations.AnimatorController GeneratePressAnimatorController() { // Prepare the triggers list List <string> triggers = new List <string>(); triggers.Add((!string.IsNullOrEmpty(this.pressNormalTriggerProperty.stringValue)) ? this.pressNormalTriggerProperty.stringValue : "Normal"); triggers.Add((!string.IsNullOrEmpty(this.pressPressTriggerProperty.stringValue)) ? this.pressPressTriggerProperty.stringValue : "Pressed"); return(UIAnimatorControllerGenerator.GenerateAnimatorContoller(triggers, this.pressTargetGraphicProperty.objectReferenceValue.name)); }
/// <summary> /// Generate an the animator contoller. /// </summary> /// <returns>The animator contoller.</returns> /// <param name="triggersProperty">Triggers property.</param> /// <param name="preferredName">Preferred name.</param> public static UnityEditor.Animations.AnimatorController GenerateAnimatorContoller(SerializedProperty triggersProperty, string preferredName) { // Prepare the triggers list List <string> triggersList = new List <string>(); SerializedProperty serializedProperty = triggersProperty.Copy(); SerializedProperty endProperty = serializedProperty.GetEndProperty(); while (serializedProperty.NextVisible(true) && !SerializedProperty.EqualContents(serializedProperty, endProperty)) { triggersList.Add(!string.IsNullOrEmpty(serializedProperty.stringValue) ? serializedProperty.stringValue : serializedProperty.name); } // Generate the animator controller return(UIAnimatorControllerGenerator.GenerateAnimatorContoller(triggersList, preferredName)); }
/// <summary> /// Generates an animator contoller. /// </summary> /// <returns>The animator contoller.</returns> /// <param name="animationTriggers">Animation triggers.</param> /// <param name="preferredName">The preferred animator name.</param> public static UnityEditor.Animations.AnimatorController GenerateAnimatorContoller(List <string> animationTriggers, string preferredName) { return(UIAnimatorControllerGenerator.GenerateAnimatorContoller(animationTriggers, preferredName, false)); }
private void DrawTargetImageProperties() { EditorGUILayout.LabelField("Image Target Properties", EditorStyles.boldLabel); EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_ImageTargetProperty); // Check if image is set if (this.m_ImageTargetProperty.objectReferenceValue != null) { Image image = (this.m_ImageTargetProperty.objectReferenceValue as Image); EditorGUILayout.PropertyField(this.m_ImageTransitionProperty); // Get the selected transition Selectable.Transition transition = (Selectable.Transition) this.m_ImageTransitionProperty.enumValueIndex; if (transition != Selectable.Transition.None) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); if (transition == Selectable.Transition.ColorTint) { EditorGUILayout.PropertyField(this.m_ImageColorsProperty); } else if (transition == Selectable.Transition.SpriteSwap) { EditorGUILayout.PropertyField(this.m_ImageSpriteStateProperty); } else if (transition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.m_ImageAnimationTriggersProperty); Animator animator = image.gameObject.GetComponent <Animator>(); if (animator == null || animator.runtimeAnimatorController == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.m_ImageAnimationTriggersProperty, this.target.name); if (animatorController != null) { if (animator == null) { animator = image.gameObject.AddComponent <Animator>(); } UnityEditor.Animations.AnimatorController.SetAnimatorController(animator, animatorController); } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); }
/// <summary> /// Draws the option background layout properties. /// </summary> public void DrawOptionBackgroundLayoutProperties() { bool newState = EditorGUILayout.Foldout(this.showOptionBackgroundLayout, "Option Background Layout", this.m_FoldoutStyle); if (newState != this.showOptionBackgroundLayout) { EditorPrefs.SetBool(PREFS_KEY + "5", newState); this.showOptionBackgroundLayout = newState; } if (this.showOptionBackgroundLayout) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteProperty, new GUIContent("Sprite")); if (this.m_OptionBackgroundSpriteProperty.objectReferenceValue != null) { EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteTypeProperty, new GUIContent("Sprite Type")); EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteColorProperty, new GUIContent("Sprite Color")); EditorGUILayout.PropertyField(this.m_OptionBackgroundTransitionTypeProperty, new GUIContent("Transition")); Selectable.Transition optionBgTransition = (Selectable.Transition) this.m_OptionBackgroundTransitionTypeProperty.enumValueIndex; if (optionBgTransition != Selectable.Transition.None) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); if (optionBgTransition == Selectable.Transition.ColorTint) { EditorGUILayout.PropertyField(this.m_OptionBackgroundTransColorsProperty, true); } else if (optionBgTransition == Selectable.Transition.SpriteSwap) { EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteStatesProperty, true); } else if (optionBgTransition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.m_OptionBackgroundAnimatorControllerProperty, new GUIContent("Animator Controller")); EditorGUILayout.PropertyField(this.m_OptionBackgroundAnimationTriggersProperty, true); if (this.m_OptionBackgroundAnimatorControllerProperty.objectReferenceValue == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.m_OptionBackgroundAnimationTriggersProperty, target.name + " - Option Background"); // Apply the controller to the property if (animatorController != null) { this.m_OptionBackgroundAnimatorControllerProperty.objectReferenceValue = animatorController; } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUILayout.Separator(); bool newState2 = EditorGUILayout.Foldout(this.showOptionHover, "Option Hover Overlay", this.m_FoldoutStyle); if (newState2 != this.showOptionHover) { EditorPrefs.SetBool(PREFS_KEY + "6", newState2); this.showOptionHover = newState2; } if (this.showOptionHover) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionHoverOverlayProperty, new GUIContent("Sprite")); EditorGUILayout.PropertyField(this.m_OptionHoverOverlayColorProperty, new GUIContent("Sprite Color")); if (this.m_OptionHoverOverlayProperty.objectReferenceValue != null) { EditorGUILayout.LabelField("Transition", EditorStyles.boldLabel); EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionHoverOverlayColorBlockProperty, new GUIContent("Colors"), true); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUILayout.Separator(); bool newState3 = EditorGUILayout.Foldout(this.showOptionPress, "Option Press Overlay", this.m_FoldoutStyle); if (newState3 != this.showOptionPress) { EditorPrefs.SetBool(PREFS_KEY + "7", newState3); this.showOptionPress = newState3; } if (this.showOptionPress) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionPressOverlayProperty, new GUIContent("Sprite")); EditorGUILayout.PropertyField(this.m_OptionPressOverlayColorProperty, new GUIContent("Sprite Color")); if (this.m_OptionPressOverlayProperty.objectReferenceValue != null) { EditorGUILayout.LabelField("Transition", EditorStyles.boldLabel); EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionPressOverlayColorBlockProperty, new GUIContent("Colors"), true); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } }
public override void OnInspectorGUI() { this.serializedObject.Update(); EditorGUILayout.Separator(); EditorGUILayout.PropertyField(this.serializedObject.FindProperty("transitionType"), new GUIContent("Transition")); Selectable.Transition transition = (Selectable.Transition) this.serializedObject.FindProperty("transitionType").enumValueIndex; Graphic graphic = this.serializedObject.FindProperty("targetGraphic").objectReferenceValue as Graphic; // Check if the transition requires a graphic if (transition == Selectable.Transition.ColorTint || transition == Selectable.Transition.SpriteSwap) { EditorGUILayout.PropertyField(this.serializedObject.FindProperty("targetGraphic"), new GUIContent("Target Graphic")); if (transition == Selectable.Transition.ColorTint) { if (graphic == null) { EditorGUILayout.HelpBox("You must have a Graphic target in order to use a color transition.", MessageType.Info); } else { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(serializedObject.FindProperty("colors"), new GUIContent("Colors"), true); if (EditorGUI.EndChangeCheck()) { graphic.canvasRenderer.SetColor(this.serializedObject.FindProperty("colors").FindPropertyRelative("m_NormalColor").colorValue); } } } else if (transition == Selectable.Transition.SpriteSwap) { if (graphic as Image == null) { EditorGUILayout.HelpBox("You must have a Image target in order to use a sprite swap transition.", MessageType.Info); } else { EditorGUILayout.PropertyField(this.serializedObject.FindProperty("spriteState"), new GUIContent("Sprites"), true); } } } else if (transition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.serializedObject.FindProperty("animationTriggers"), true); Animator animator = (target as UISelectField_Arrow).gameObject.GetComponent <Animator>(); if (animator == null || animator.runtimeAnimatorController == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.serializedObject.FindProperty("animationTriggers"), this.target.name); if (animatorController != null) { if (animator == null) { animator = (target as UISelectField_Arrow).gameObject.AddComponent <Animator>(); } UnityEditor.Animations.AnimatorController.SetAnimatorController(animator, animatorController); } } } } this.serializedObject.ApplyModifiedProperties(); }
/// <summary> /// Draws the list layout properties. /// </summary> public void DrawListLayoutProperties() { bool newState = EditorGUILayout.Foldout(this.showListLayout, "List Layout", this.m_FoldoutStyle); if (newState != this.showListLayout) { EditorPrefs.SetBool(PREFS_KEY + "2", newState); this.showListLayout = newState; } if (this.showListLayout) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_ListBackgroundSpriteProperty, new GUIContent("Sprite")); if (this.m_ListBackgroundSpriteProperty.objectReferenceValue != null) { EditorGUILayout.PropertyField(this.m_ListBackgroundSpriteTypeProperty, new GUIContent("Sprite Type")); EditorGUILayout.PropertyField(this.m_ListBackgroundColorProperty, new GUIContent("Sprite Color")); } EditorGUILayout.PropertyField(this.m_ListMarginsProperty, new GUIContent("Margin"), true); EditorGUILayout.PropertyField(this.m_ListPaddingProperty, new GUIContent("Padding"), true); EditorGUILayout.PropertyField(this.m_ListSpacingProperty, new GUIContent("Spacing"), true); EditorGUILayout.PropertyField(this.m_ListAnimationTypeProperty, new GUIContent("Transition"), true); UISelectField.ListAnimationType animationType = (UISelectField.ListAnimationType) this.m_ListAnimationTypeProperty.enumValueIndex; if (animationType == UISelectField.ListAnimationType.Fade) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_ListAnimationDurationProperty, new GUIContent("Duration"), true); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } else if (animationType == UISelectField.ListAnimationType.Animation) { EditorGUILayout.PropertyField(this.m_ListAnimatorControllerProperty, new GUIContent("Animator Controller")); EditorGUILayout.PropertyField(this.m_ListlistAnimationOpenTriggerProperty, new GUIContent("Open Trigger")); EditorGUILayout.PropertyField(this.m_ListlistAnimationCloseTriggerProperty, new GUIContent("Close Trigger")); if (this.m_ListAnimatorControllerProperty.objectReferenceValue == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Prepare the triggers list List <string> triggers = new List <string>(); triggers.Add(!string.IsNullOrEmpty(this.m_ListlistAnimationOpenTriggerProperty.stringValue) ? this.m_ListlistAnimationOpenTriggerProperty.stringValue : "Open"); triggers.Add(!string.IsNullOrEmpty(this.m_ListlistAnimationCloseTriggerProperty.stringValue) ? this.m_ListlistAnimationCloseTriggerProperty.stringValue : "Close"); // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(triggers, target.name + " - List"); // Apply the controller to the property if (animatorController != null) { this.m_ListAnimatorControllerProperty.objectReferenceValue = animatorController; } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } }
/// <summary> /// Draws the select field layot properties. /// </summary> public void DrawSelectFieldLayotProperties() { bool newState = EditorGUILayout.Foldout(this.showSelectLayout, "Select Field Layout", this.m_FoldoutStyle); if (newState != this.showSelectLayout) { EditorPrefs.SetBool(PREFS_KEY + "1", newState); this.showSelectLayout = newState; } if (this.showSelectLayout) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_TransitionProperty, new GUIContent("Transition")); Graphic graphic = this.m_TargetGraphicProperty.objectReferenceValue as Graphic; Selectable.Transition transition = (Selectable.Transition) this.m_TransitionProperty.enumValueIndex; // Check if the transition requires a graphic if (transition == Selectable.Transition.ColorTint || transition == Selectable.Transition.SpriteSwap) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_TargetGraphicProperty); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } // Check if we have a transition set if (transition != Selectable.Transition.None) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); if (transition == Selectable.Transition.ColorTint) { if (graphic == null) { EditorGUILayout.HelpBox("You must have a Graphic target in order to use a color transition.", MessageType.Info); } else { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.m_ColorBlockProperty, true); if (EditorGUI.EndChangeCheck()) { graphic.canvasRenderer.SetColor(this.m_ColorBlockProperty.FindPropertyRelative("m_NormalColor").colorValue); } } } else if (transition == Selectable.Transition.SpriteSwap) { if (graphic as Image == null) { EditorGUILayout.HelpBox("You must have a Image target in order to use a sprite swap transition.", MessageType.Info); } else { EditorGUILayout.PropertyField(this.m_SpriteStateProperty, true); } } else if (transition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.m_AnimTriggerProperty, true); Animator animator = (target as UISelectField).animator; if (animator == null || animator.runtimeAnimatorController == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.m_AnimTriggerProperty, target.name); if (animatorController != null) { if (animator == null) { animator = (target as UISelectField).gameObject.AddComponent <Animator>(); } UnityEditor.Animations.AnimatorController.SetAnimatorController(animator, animatorController); } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } }
protected void DrawTransitionProperties() { EditorGUILayout.LabelField("Transition Properties", EditorStyles.boldLabel); EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_Transition, new GUIContent("Transition")); // Get the transition UIScene.Transition transition = (UIScene.Transition) this.m_Transition.enumValueIndex; if (transition != UIScene.Transition.None && transition != UIScene.Transition.Animation) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_TransitionDuration, new GUIContent("Duration")); EditorGUILayout.PropertyField(this.m_TransitionEasing, new GUIContent("Easing")); EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } else if (transition == UIScene.Transition.Animation) { EditorGUILayout.PropertyField(this.m_AnimateInTrigger, new GUIContent("Animate In Trigger")); EditorGUILayout.PropertyField(this.m_AnimateOutTrigger, new GUIContent("Animate Out Trigger")); UIScene scene = (target as UIScene); Animator animator = scene.animator; if (animator == null || animator.runtimeAnimatorController == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { System.Collections.Generic.List <string> triggersList = new System.Collections.Generic.List <string>(); triggersList.Add(this.m_AnimateInTrigger.stringValue); triggersList.Add(this.m_AnimateOutTrigger.stringValue); // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(triggersList, scene.gameObject.name, true); if (animatorController != null) { if (animator == null) { animator = scene.gameObject.AddComponent <Animator>(); } UnityEditor.Animations.AnimatorController.SetAnimatorController(animator, animatorController); } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); }
public override void OnInspectorGUI() { this.serializedObject.Update(); Selectable.Transition transition = (Selectable.Transition) this.m_TransitionProperty.enumValueIndex; Graphic graphic = this.m_TargetGraphicProperty.objectReferenceValue as Graphic; GameObject targetGameObject = this.m_TargetGameObjectProperty.objectReferenceValue as GameObject; EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_TransitionProperty, new GUIContent("Transition")); EditorGUI.indentLevel++; // Check if the transition requires a graphic if (transition == Selectable.Transition.ColorTint || transition == Selectable.Transition.SpriteSwap) { EditorGUILayout.PropertyField(this.m_TargetGraphicProperty, new GUIContent("Target Graphic")); if (transition == Selectable.Transition.ColorTint) { if (graphic == null) { EditorGUILayout.HelpBox("You must have a Graphic target in order to use a color transition.", MessageType.Info); } else { EditorGUILayout.PropertyField(this.m_ColorsProperty, true); } } else if (transition == Selectable.Transition.SpriteSwap) { if (graphic as Image == null) { EditorGUILayout.HelpBox("You must have a Image target in order to use a sprite swap transition.", MessageType.Info); } else { EditorGUILayout.PropertyField(this.m_SpriteStateProperty, true); } } } else if (transition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.m_TargetGameObjectProperty, new GUIContent("Target GameObject")); if (targetGameObject == null) { EditorGUILayout.HelpBox("You must have a Game Object target in order to use a animation transition.", MessageType.Info); } else { EditorGUILayout.PropertyField(this.m_AnimationTriggersProperty, true); Animator animator = (target as UIButtonExtended_Target).animator; if (animator == null || animator.runtimeAnimatorController == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.m_AnimationTriggersProperty, this.m_TargetGameObjectProperty.objectReferenceValue.name); if (animatorController != null) { if (animator == null) { animator = (target as UIButtonExtended_Target).targetGameObject.AddComponent <Animator>(); } UnityEditor.Animations.AnimatorController.SetAnimatorController(animator, animatorController); } } } } } this.serializedObject.ApplyModifiedProperties(); }
/// <summary> /// Draws the option background layout properties. /// </summary> public void DrawOptionBackgroundLayoutProperties() { EditorGUILayout.LabelField("Option Background Layout", EditorStyles.boldLabel); EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteProperty, new GUIContent("Sprite")); if (this.m_OptionBackgroundSpriteProperty.objectReferenceValue != null) { EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteTypeProperty, new GUIContent("Sprite Type")); EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteColorProperty, new GUIContent("Sprite Color")); EditorGUILayout.PropertyField(this.m_OptionBackgroundTransitionTypeProperty, new GUIContent("Transition")); Selectable.Transition optionBgTransition = (Selectable.Transition) this.m_OptionBackgroundTransitionTypeProperty.enumValueIndex; if (optionBgTransition != Selectable.Transition.None) { EditorGUI.indentLevel = (EditorGUI.indentLevel + 1); if (optionBgTransition == Selectable.Transition.ColorTint) { EditorGUILayout.PropertyField(this.m_OptionBackgroundTransColorsProperty, true); } else if (optionBgTransition == Selectable.Transition.SpriteSwap) { EditorGUILayout.PropertyField(this.m_OptionBackgroundSpriteStatesProperty, true); } else if (optionBgTransition == Selectable.Transition.Animation) { EditorGUILayout.PropertyField(this.m_OptionBackgroundAnimatorControllerProperty, new GUIContent("Animator Controller")); EditorGUILayout.PropertyField(this.m_OptionBackgroundAnimationTriggersProperty, true); if (this.m_OptionBackgroundAnimatorControllerProperty.objectReferenceValue == null) { Rect controlRect = EditorGUILayout.GetControlRect(); controlRect.xMin = (controlRect.xMin + EditorGUIUtility.labelWidth); if (GUI.Button(controlRect, "Auto Generate Animation", EditorStyles.miniButton)) { // Generate the animator controller UnityEditor.Animations.AnimatorController animatorController = UIAnimatorControllerGenerator.GenerateAnimatorContoller(this.m_OptionBackgroundAnimationTriggersProperty, target.name + " - Option Background"); // Apply the controller to the property if (animatorController != null) { this.m_OptionBackgroundAnimatorControllerProperty.objectReferenceValue = animatorController; } } } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); } } EditorGUI.indentLevel = (EditorGUI.indentLevel - 1); }