Exemplo n.º 1
0
    Canvas GetParentCanvas()
    {
        // If the current selection is null, then return.
        if (Selection.activeGameObject == null)
        {
            return(null);
        }

        // Store the current parent.
        Transform parent = Selection.activeGameObject.transform.parent;

        // Loop through parents as long as there is one.
        while (parent != null)
        {
            // If there is a Canvas component, return the component.
            if (parent.transform.GetComponent <Canvas>() && parent.transform.GetComponent <Canvas>().enabled == true)
            {
                return(parent.transform.GetComponent <Canvas>());
            }

            // Else, shift to the next parent.
            parent = parent.transform.parent;
        }
        if (parent == null && PrefabUtility.GetPrefabType(Selection.activeGameObject) != PrefabType.Prefab)
        {
            UltimateButtonCreator.RequestCanvas(Selection.activeGameObject);
        }

        return(null);
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.Space();

        #region CANVAS ERRORS
        /* ///// ---------------------------------------- < CANVAS ERRORS > ---------------------------------------- \\\\\ */
        if (CanvasErrors() == true)
        {
            if (parentCanvas.renderMode != RenderMode.ScreenSpaceOverlay)
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.HelpBox("The parent Canvas needs to be set to 'Screen Space - Overlay' in order for the Ultimate Button to function correctly.", MessageType.Error);
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Update Canvas", EditorStyles.miniButtonLeft))
                {
                    parentCanvas.renderMode = RenderMode.ScreenSpaceOverlay;
                    parentCanvas            = GetParentCanvas();
                }
                if (GUILayout.Button("Update Button", EditorStyles.miniButtonRight))
                {
                    UltimateButtonCreator.RequestCanvas(Selection.activeGameObject);
                    parentCanvas = GetParentCanvas();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
            if (parentCanvas.GetComponent <CanvasScaler>())
            {
                if (parentCanvas.GetComponent <CanvasScaler>().uiScaleMode != CanvasScaler.ScaleMode.ConstantPixelSize)
                {
                    EditorGUILayout.BeginVertical("Box");
                    EditorGUILayout.HelpBox("The Canvas Scaler component located on the parent Canvas needs to be set to 'Constant Pixel Size' in order for the Ultimate Button to function correctly.", MessageType.Error);
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("Update Canvas", EditorStyles.miniButtonLeft))
                    {
                        parentCanvas.GetComponent <CanvasScaler>().uiScaleMode = CanvasScaler.ScaleMode.ConstantPixelSize;
                        parentCanvas = GetParentCanvas();
                        UltimateButton button = ( UltimateButton )target;
                        button.UpdatePositioning();
                    }
                    if (GUILayout.Button("Update Button", EditorStyles.miniButtonRight))
                    {
                        UltimateButtonCreator.RequestCanvas(Selection.activeGameObject);
                        parentCanvas = GetParentCanvas();
                    }
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.EndVertical();
                }
            }
            return;
        }
        /* \\\\\ -------------------------------------- < END CANVAS ERRORS > -------------------------------------- ///// */
        #endregion

        UltimateButton targ = ( UltimateButton )target;

        #region SIZE AND PLACEMENT
        /* ///// ---------------------------------------- < SIZE AND PLACEMENT > ---------------------------------------- \\\\\ */
        DisplayHeader("Size and Placement", "UUI_SizeAndPlacement", SizeAndPlacement);

        if (EditorGUILayout.BeginFadeGroup(SizeAndPlacement.faded))
        {
            EditorGUILayout.Space();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(positioning);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }

            if (targ.positioning == UltimateButton.Positioning.ScreenSpace)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(sizeFolder, new GUIContent("Button Size Folder"));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                EditorGUI.BeginChangeCheck();
                {
                    EditorGUILayout.PropertyField(scalingAxis);
                    EditorGUILayout.PropertyField(anchor);
                    EditorGUILayout.PropertyField(touchSize, new GUIContent("Touch Size", "The size of the area in which the touch can start"));
                    EditorGUILayout.Slider(buttonSize, 0.0f, 5.0f, new GUIContent("Button Size"));
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    TouchSizeDefaultOptions.target = targ.touchSize == UltimateButton.TouchSize.Default ? true : false;
                }

                EditorGUILayout.BeginVertical("Box");
                {
                    EditorGUILayout.LabelField("Button Position");
                    EditorGUI.indentLevel = 1;
                    {
                        EditorGUI.BeginChangeCheck();
                        {
                            EditorGUILayout.Slider(customSpacing_X, 0.0f, 50.0f, new GUIContent("X Position:"));
                            EditorGUILayout.Slider(customSpacing_Y, 0.0f, 100.0f, new GUIContent("Y Position:"));
                        }
                        if (EditorGUI.EndChangeCheck())
                        {
                            serializedObject.ApplyModifiedProperties();
                        }
                    }
                    EditorGUI.indentLevel = 0;
                }
                EditorGUILayout.EndVertical();
            }
            else if (targ.positioning == UltimateButton.Positioning.RelativeToJoystick)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(joystick);
                EditorGUILayout.PropertyField(sizeFolder, new GUIContent("Button Size Folder"));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                EditorGUI.BeginChangeCheck();
                {
                    EditorGUILayout.PropertyField(anchorSide);
                    EditorGUILayout.PropertyField(touchSize, new GUIContent("Touch Size", "The size of the area in which the touch can start"));
                    EditorGUILayout.Slider(buttonSize, 0.0f, 5.0f, new GUIContent("Button Size"));
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    TouchSizeDefaultOptions.target = targ.touchSize == UltimateButton.TouchSize.Default ? true : false;
                }

                EditorGUILayout.BeginVertical("Box");
                {
                    EditorGUILayout.LabelField("Button Position");
                    EditorGUI.indentLevel = 1;
                    {
                        EditorGUI.BeginChangeCheck();
                        {
                            EditorGUILayout.Slider(customSpacing_X, 0.0f, 100.0f, new GUIContent("X Position:"));
                            EditorGUILayout.Slider(customSpacing_Y, 0.0f, 100.0f, new GUIContent("Y Position:"));
                        }
                        if (EditorGUI.EndChangeCheck())
                        {
                            serializedObject.ApplyModifiedProperties();
                        }
                    }
                    EditorGUI.indentLevel = 0;
                }
                EditorGUILayout.EndVertical();
            }
            else if (targ.positioning == UltimateButton.Positioning.RelativeToButton)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(rectTrans, new GUIContent("Target Size Folder"));
                EditorGUILayout.PropertyField(targetButtonBase, new GUIContent("Target Button Base Image"));
                EditorGUILayout.PropertyField(sizeFolder, new GUIContent("This Button Size Folder"));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                EditorGUI.BeginChangeCheck();
                {
                    EditorGUILayout.PropertyField(anchorSide);
                    EditorGUILayout.PropertyField(touchSize, new GUIContent("Touch Size", "The size of the area in which the touch can start"));
                    EditorGUILayout.Slider(buttonSize, 0.0f, 5.0f, new GUIContent("Button Size"));
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    TouchSizeDefaultOptions.target = targ.touchSize == UltimateButton.TouchSize.Default ? true : false;
                }

                EditorGUILayout.BeginVertical("Box");
                {
                    EditorGUILayout.LabelField("Button Position");
                    EditorGUI.indentLevel = 1;
                    {
                        EditorGUI.BeginChangeCheck();
                        {
                            EditorGUILayout.Slider(customSpacing_X, -200.0f, 200.0f, new GUIContent("X Position:"));
                            EditorGUILayout.Slider(customSpacing_Y, -200.0f, 200.0f, new GUIContent("Y Position:"));
                        }
                        if (EditorGUI.EndChangeCheck())
                        {
                            serializedObject.ApplyModifiedProperties();
                        }
                    }
                    EditorGUI.indentLevel = 0;
                }
                EditorGUILayout.EndVertical();
            }
        }
        EditorGUILayout.EndFadeGroup();
        /* \\\\\ -------------------------------------- < END SIZE AND PLACEMENT > -------------------------------------- ///// */
        #endregion

        EditorGUILayout.Space();

        #region STYLE AND OPTIONS
        /* ///// ---------------------------------------- < STYLES AND OPTIONS > ---------------------------------------- \\\\\ */
        DisplayHeader("Style and Options", "UUI_StyleAndOptions", StyleAndOptions);
        if (EditorGUILayout.BeginFadeGroup(StyleAndOptions.faded))
        {
            EditorGUILayout.Space();

            if (EditorGUILayout.BeginFadeGroup(TouchSizeDefaultOptions.faded))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(imageStyle, new GUIContent("Image Style", "Determines whether the input range should be circular or square. This option affects how the Input Range and Track Input options function."));
                EditorGUILayout.Slider(inputRange, 0.0f, 1.0f, new GUIContent("Input Range", "The range that the Ultimate Button will react to when initiating and dragging the input."));
                EditorGUILayout.PropertyField(trackInput, new GUIContent("Track Input", "Enabling this option will allow the Ultimate Button to track the users input to ensure that button events and states are only called when the input is within the Input Range."));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
            }
            if (StyleAndOptions.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }

            // TRANSMIT INPUT //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(transmitInput, new GUIContent("Transmit Input", "Should the Ultimate Button transmit input events to another UI game object?"));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                TransmitInputEnabled.target = targ.transmitInput;
            }

            if (EditorGUILayout.BeginFadeGroup(TransmitInputEnabled.faded))
            {
                EditorGUI.indentLevel = 1;

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(receiver, new GUIContent("Input Receiver"));
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                EditorGUI.indentLevel = 0;
                EditorGUILayout.Space();
            }
            if (StyleAndOptions.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }

            // TAP COUNT OPTIONS //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(tapCountOption);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                tapOption.target = targ.tapCountOption != UltimateButton.TapCountOption.NoCount ? true : false;
            }
            if (EditorGUILayout.BeginFadeGroup(tapOption.faded))
            {
                EditorGUI.indentLevel = 1;
                EditorGUI.BeginChangeCheck();
                {
                    EditorGUILayout.Slider(tapCountDuration, 0.0f, 1.0f, new GUIContent("Tap Time Window"));
                    EditorGUI.BeginDisabledGroup(targ.tapCountOption != UltimateButton.TapCountOption.Accumulate);
                    EditorGUILayout.IntSlider(targetTapCount, 1, 5, new GUIContent("Target Tap Count"));
                    EditorGUI.EndDisabledGroup();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                EditorGUI.indentLevel = 0;

                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Example Code"))
                {
                    ScriptReference.target = true;
                    EditorPrefs.SetBool("UUI_ScriptReference", true);
                    scriptCast = ScriptCast.GetTapCount;
                }
                if (GUILayout.Button("Button Events"))
                {
                    ButtonEvents.target = true;
                    EditorPrefs.SetBool("UUI_ExtraOption_01", true);
                }
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
            }
            if (StyleAndOptions.faded == 1)
            {
                EditorGUILayout.EndFadeGroup();
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(8);
            EditorGUILayout.LabelField("───────");
            EditorGUILayout.EndHorizontal();

            // BASE COLOR //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(buttonBase);
            EditorGUILayout.PropertyField(baseColor);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                targ.UpdateBaseColor(targ.baseColor);
                if (targ.buttonBase != null)
                {
                    EditorUtility.SetDirty(targ.buttonBase);
                }
            }
            if (targ.buttonBase == null)
            {
                EditorGUI.indentLevel = 1;
                EditorGUILayout.HelpBox("The Button Base image has not been assigned. Please make sure to assign this variable within the Assigned Variables section.", MessageType.Warning);
                EditorGUI.indentLevel = 0;
                EditorGUILayout.Space();
            }

            // --------------------------< HIGHLIGHT >-------------------------- //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(showHighlight, new GUIContent("Show Highlight", "Displays the highlight images with the Highlight Color variable."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                SetHighlight(targ);
                highlightOption.target = targ.showHighlight;
                if (targ.buttonHighlight != null)
                {
                    EditorUtility.SetDirty(targ.buttonHighlight);
                }
            }
            EditorGUI.indentLevel = 1;
            if (EditorGUILayout.BeginFadeGroup(highlightOption.faded))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(buttonHighlight, new GUIContent("Button Highlight"));
                EditorGUILayout.PropertyField(highlightColor);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                    targ.UpdateHighlightColor(targ.highlightColor);
                    if (targ.buttonHighlight != null)
                    {
                        EditorUtility.SetDirty(targ.buttonHighlight);
                    }
                }
                EditorGUILayout.Space();
            }
            if (StyleAndOptions.faded == 1)
            {
                EditorGUILayout.EndFadeGroup();
            }

            EditorGUI.indentLevel = 0;
            // ------------------------< END HIGHLIGHT >------------------------ //

            // ---------------------------< TENSION >--------------------------- //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(showTension, new GUIContent("Show Tension", "Displays the visual state of the button using the tension color options."));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                SetTensionAccent(targ);
                tensionOption.target = targ.showTension;
                if (targ.tensionAccent != null)
                {
                    EditorUtility.SetDirty(targ.tensionAccent);
                }
            }

            EditorGUI.indentLevel = 1;

            if (EditorGUILayout.BeginFadeGroup(tensionOption.faded))
            {
                EditorGUI.BeginChangeCheck();
                {
                    EditorGUILayout.PropertyField(tensionAccent);
                    EditorGUILayout.PropertyField(tensionColorNone, new GUIContent("Tension None", "The Color of the Tension with no input."));
                    EditorGUILayout.PropertyField(tensionColorFull, new GUIContent("Tension Full", "The Color of the Tension when there is input."));
                    EditorGUILayout.PropertyField(tensionFadeInDuration, new GUIContent("Fade In Duration", "Time is seconds for the tension to fade in, with 0 being instant."));
                    EditorGUILayout.PropertyField(tensionFadeOutDuration, new GUIContent("Fade Out Duration", "Time is seconds for the tension to fade out, with 0 being instant."));
                }
                if (EditorGUI.EndChangeCheck())
                {
                    if (tensionFadeInDuration.floatValue < 0)
                    {
                        tensionFadeInDuration.floatValue = 0;
                    }
                    if (tensionFadeOutDuration.floatValue < 0)
                    {
                        tensionFadeOutDuration.floatValue = 0;
                    }

                    serializedObject.ApplyModifiedProperties();
                    if (targ.tensionAccent != null)
                    {
                        targ.tensionAccent.color = targ.tensionColorNone;
                        EditorUtility.SetDirty(targ.tensionAccent);
                    }
                }
                if (EditorGUILayout.BeginFadeGroup(TensionAccentError.faded))
                {
                    EditorGUILayout.HelpBox("The Tension Accent image has not been assigned. Please make sure to assign this immediately.", MessageType.Error);
                }
                if (StyleAndOptions.faded == 1.0f && tensionOption.faded == 1.0f)
                {
                    EditorGUILayout.EndFadeGroup();
                }

                EditorGUILayout.Space();
            }
            if (StyleAndOptions.faded == 1)
            {
                EditorGUILayout.EndFadeGroup();
            }

            EditorGUI.indentLevel = 0;
            // -------------------------< END TENSION >------------------------- //

            // USE ANIMATION OPTIONS //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(useAnimation);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                SetAnimation(targ);
                animationOption.target = targ.useAnimation;
            }
            if (EditorGUILayout.BeginFadeGroup(animationOption.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(buttonAnimator, new GUIContent("Animator"));
                EditorGUI.indentLevel--;
            }
            if (StyleAndOptions.faded == 1)
            {
                EditorGUILayout.EndFadeGroup();
            }

            // USE FADE OPTIONS //
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(useFade);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                fadeOption.target = targ.useFade;

                if (!targ.GetComponent <CanvasGroup>())
                {
                    targ.gameObject.AddComponent <CanvasGroup>();
                }

                if (targ.useFade == true)
                {
                    targ.gameObject.GetComponent <CanvasGroup>().alpha = targ.fadeUntouched;
                }
                else
                {
                    targ.gameObject.GetComponent <CanvasGroup>().alpha = 1.0f;
                }
            }
            if (EditorGUILayout.BeginFadeGroup(fadeOption.faded))
            {
                EditorGUI.indentLevel = 1;
                {
                    EditorGUI.BeginChangeCheck();
                    {
                        EditorGUILayout.Slider(fadeUntouched, 0.0f, 1.0f, new GUIContent("Fade Untouched", "This controls the alpha of the button when it is NOT receiving any input."));
                        EditorGUILayout.Slider(fadeTouched, 0.0f, 1.0f, new GUIContent("Fade Touched", "This controls the alpha of the button when it is receiving input."));
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        serializedObject.ApplyModifiedProperties();

                        if (!targ.GetComponent <CanvasGroup>())
                        {
                            targ.gameObject.AddComponent <CanvasGroup>();
                        }

                        if (targ.useFade == true)
                        {
                            targ.gameObject.GetComponent <CanvasGroup>().alpha = targ.fadeUntouched;
                        }
                        else
                        {
                            targ.gameObject.GetComponent <CanvasGroup>().alpha = 1.0f;
                        }
                    }
                    EditorGUI.BeginChangeCheck();
                    {
                        EditorGUILayout.PropertyField(fadeInDuration, new GUIContent("Fade In Duration", "Time is seconds for the button to fade in, with 0 being instant."));
                        EditorGUILayout.PropertyField(fadeOutDuration, new GUIContent("Fade Out Duration", "Time is seconds for the button to fade out, with 0 being instant."));
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (fadeInDuration.floatValue < 0)
                        {
                            fadeInDuration.floatValue = 0;
                        }
                        if (fadeOutDuration.floatValue < 0)
                        {
                            fadeOutDuration.floatValue = 0;
                        }

                        serializedObject.ApplyModifiedProperties();
                    }
                }
                EditorGUI.indentLevel = 0;
                EditorGUILayout.Space();
            }
            if (StyleAndOptions.faded == 1)
            {
                EditorGUILayout.EndFadeGroup();
            }
        }
        EditorGUILayout.EndFadeGroup();
        /* \\\\\ -------------------------------------- < END STYLES AND OPTIONS > -------------------------------------- ///// */
        #endregion

        EditorGUILayout.Space();

        #region SCRIPT REFERENCE
        /* \\\\\ ----------------------------------------- < SCRIPT REFERENCE > ----------------------------------------- ///// */
        DisplayHeader("Script Reference", "UUI_ScriptReference", ScriptReference);
        if (EditorGUILayout.BeginFadeGroup(ScriptReference.faded))
        {
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(buttonName);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                buttonNameAssigned.target   = targ.buttonName == string.Empty ? false : true;
                buttonNameUnassigned.target = targ.buttonName != string.Empty ? false : true;
            }

            if (EditorGUILayout.BeginFadeGroup(buttonNameUnassigned.faded))
            {
                EditorGUILayout.HelpBox("Please assign a Button Name in order to be able to get this button's states dynamically.", MessageType.Warning);
            }
            if (ScriptReference.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }

            if (EditorGUILayout.BeginFadeGroup(buttonNameAssigned.faded))
            {
                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Example Code:", EditorStyles.boldLabel);
                EditorGUILayout.LabelField("Please select the function you would like to copy and paste into your script.", EditorStyles.wordWrappedLabel);
                scriptCast = ( ScriptCast )EditorGUILayout.EnumPopup(scriptCast);
                GUILayout.Space(5);
                switch (scriptCast)
                {
                case ScriptCast.GetButtonDown:
                {
                    EditorGUILayout.TextField("if( UltimateButton.GetButtonDown( \"" + targ.buttonName + "\" ) )");
                }
                break;

                case ScriptCast.GetButtonUp:
                {
                    EditorGUILayout.TextField("if( UltimateButton.GetButtonUp( \"" + targ.buttonName + "\" ) )");
                }
                break;

                case ScriptCast.GetButton:
                default:
                {
                    EditorGUILayout.TextField("if( UltimateButton.GetButton( \"" + targ.buttonName + "\" ) )");
                }
                break;

                case ScriptCast.GetTapCount:
                {
                    EditorGUILayout.TextField("if( UltimateButton.GetTapCount( \"" + targ.buttonName + "\" ) )");

                    if (targ.tapCountOption == UltimateButton.TapCountOption.NoCount)
                    {
                        EditorGUILayout.HelpBox("Tap Count is not being used. Please set the Tap Count Option in order to use this option.", MessageType.Warning);
                    }
                }
                break;

                case ScriptCast.GetUltimateButton:
                {
                    EditorGUILayout.TextField("UltimateButton.GetUltimateButton( \"" + targ.buttonName + "\" )");
                }
                break;

                case ScriptCast.DisableButton:
                {
                    EditorGUILayout.TextField("UltimateButton.DisableButton( \"" + targ.buttonName + "\" );");
                }
                break;

                case ScriptCast.EnableButton:
                {
                    EditorGUILayout.TextField("UltimateButton.EnableButton( \"" + targ.buttonName + "\" );");
                }
                break;
                }
                GUILayout.Space(1);
                EditorGUILayout.EndVertical();

                if (GUILayout.Button("Open Documentation"))
                {
                    UltimateButtonWindow.OpenDocumentation();
                }
            }
            if (ScriptReference.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }
        }
        EditorGUILayout.EndFadeGroup();
        /* ///// --------------------------------------- < END SCRIPT REFERENCE > --------------------------------------- \\\\\ */
        #endregion

        EditorGUILayout.Space();

        #region BUTTON EVENTS
        /* \\\\\ ----------------------------------------- < SCRIPT REFERENCE > ----------------------------------------- ///// */
        DisplayHeader("Button Events", "UUI_ExtraOption_01", ButtonEvents);
        if (EditorGUILayout.BeginFadeGroup(ButtonEvents.faded))
        {
            EditorGUILayout.Space();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(onButtonDown);
            EditorGUILayout.PropertyField(onButtonUp);

            if (EditorGUILayout.BeginFadeGroup(tapOption.faded))
            {
                EditorGUILayout.PropertyField(tapCountEvent);
            }
            if (ButtonEvents.faded == 1.0f)
            {
                EditorGUILayout.EndFadeGroup();
            }

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
        EditorGUILayout.EndFadeGroup();
        /* ///// --------------------------------------- < END SCRIPT REFERENCE > --------------------------------------- \\\\\ */
        #endregion

        EditorGUILayout.Space();

        if (PrefabUtility.GetPrefabType(Selection.activeGameObject) == PrefabType.Prefab)
        {
            GUISkin defaultSkin     = GUI.skin;
            int     defaultFontSize = defaultSkin.FindStyle("Button").fontSize;
            defaultSkin.FindStyle("Button").fontSize = 12;
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Add to Scene", GUILayout.Height(25), GUILayout.Width(200)))
            {
                UltimateButtonCreator.CreateNewUltimateButton(targ.gameObject);
            }
            GUILayout.FlexibleSpace();
            GUILayout.Space(10);
            EditorGUILayout.EndHorizontal();
            defaultSkin.FindStyle("Button").fontSize = defaultFontSize;
        }

        Repaint();
    }