private void OnEnable()
            {
                var toggleButton = target as ToggleButton;

                backgroundImage = serializedObject.FindProperty(ExtraMethods
                                                                .NameOf(() => toggleButton.backgroundImage));
                leverImage = serializedObject.FindProperty(ExtraMethods
                                                           .NameOf(() => toggleButton.leverImage));
                material = serializedObject.FindProperty(ExtraMethods
                                                         .NameOf(() => toggleButton.material));
                size = serializedObject.FindProperty(ExtraMethods
                                                     .NameOf(() => toggleButton.size));
                backgroundColorOn = serializedObject.FindProperty(ExtraMethods
                                                                  .NameOf(() => toggleButton.backgroundColorOn));
                backgroundColorOff = serializedObject.FindProperty(ExtraMethods
                                                                   .NameOf(() => toggleButton.backgroundColorOff));
                leverColorOn = serializedObject.FindProperty(ExtraMethods
                                                             .NameOf(() => toggleButton.leverColorOn));
                leverColorOff = serializedObject.FindProperty(ExtraMethods
                                                              .NameOf(() => toggleButton.leverColorOff));
                backgroundOffSprite = serializedObject.FindProperty(ExtraMethods
                                                                    .NameOf(() => toggleButton.backgroundOffSprite));
                backgroundOnSprite = serializedObject.FindProperty(ExtraMethods
                                                                   .NameOf(() => toggleButton.backgroundOnSprite));
                leverOffSprite = serializedObject.FindProperty(ExtraMethods
                                                               .NameOf(() => toggleButton.leverOffSprite));
                leverOnSprite = serializedObject.FindProperty(ExtraMethods
                                                              .NameOf(() => toggleButton.leverOnSprite));
                leverColorHovered = serializedObject.FindProperty(ExtraMethods
                                                                  .NameOf(() => toggleButton.leverColorHovered));
                type = serializedObject.FindProperty(ExtraMethods
                                                     .NameOf(() => toggleButton.type));
                hoverEffect = serializedObject.FindProperty(ExtraMethods
                                                            .NameOf(() => toggleButton.hoverEffect));
                backgroundTransitionType = serializedObject.FindProperty(ExtraMethods
                                                                         .NameOf(() => toggleButton.backgroundTransitionType));
                leverTransitionType = serializedObject.FindProperty(ExtraMethods
                                                                    .NameOf(() => toggleButton.leverTransitionType));
                animate = serializedObject.FindProperty(ExtraMethods
                                                        .NameOf(() => toggleButton.animate));
                isOn = serializedObject.FindProperty(ExtraMethods
                                                     .NameOf(() => toggleButton.isOn));
            }
            public override void OnInspectorGUI()
            {
                // base.OnInspectorGUI();

                var toggleButton = target as ToggleButton;

                showReferences = EditorGUILayout.Foldout(
                    showReferences,
                    "References",
                    true);


                if (showReferences)
                {
                    // Moving stuff a bit to the right
                    EditorGUI.indentLevel++;

                    // "background" image object
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(
                        ExtraMethods.NameOfC(() => toggleButton.backgroundImage));
                    backgroundImage.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.backgroundImage,
                        typeof(Image),
                        true) as Image;
                    EditorGUILayout.EndHorizontal();

                    // "lever" image object
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(
                        ExtraMethods.NameOfC(() => toggleButton.leverImage));
                    leverImage.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.leverImage,
                        typeof(Image),
                        true) as Image;
                    EditorGUILayout.EndHorizontal();

                    // "material" reference
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(
                        ExtraMethods.NameOfC(() => toggleButton.material));
                    material.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.material,
                        typeof(Material),
                        true) as Material;
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.Space();

                    // Changing back to original for the rest of the content
                    EditorGUI.indentLevel--;
                }


                EditorGUILayout.Space();
                EditorGUILayout.LabelField("General", EditorStyles.boldLabel);

                // Size
                size.floatValue = EditorGUILayout.FloatField(
                    ExtraMethods.NameOfC(() => toggleButton.size),
                    toggleButton.size);

                // Type
                type.enumValueIndex = (int)(ToggleButtonType)
                                      EditorGUILayout.EnumPopup(
                    ExtraMethods.NameOfC(() => toggleButton.type),
                    toggleButton.type);

                // Hover effect
                hoverEffect.enumValueIndex = (int)(ToggleButtonHoverEffect)
                                             EditorGUILayout.EnumPopup(
                    ExtraMethods.NameOfC(() => toggleButton.hoverEffect),
                    toggleButton.hoverEffect);

                // Animate
                animate.boolValue = EditorGUILayout.Toggle(
                    ExtraMethods.NameOfC(() => toggleButton.animate),
                    toggleButton.animate);

                // Is on
                isOn.boolValue = EditorGUILayout.Toggle(
                    ExtraMethods.NameOfC(() => toggleButton.isOn),
                    toggleButton.isOn);


                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Background", EditorStyles.boldLabel);

                backgroundTransitionType.enumValueIndex = (int)(TransitionType)
                                                          EditorGUILayout.EnumPopup(
                    "Transition Type",
                    toggleButton.backgroundTransitionType);

                if (toggleButton.backgroundTransitionType == TransitionType.ChangeColor)
                {
                    // Background off sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Sprite");
                    backgroundOffSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.backgroundOffSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();

                    // Background color on
                    backgroundColorOn.colorValue = EditorGUILayout.ColorField(
                        "On Color",
                        toggleButton.backgroundColorOn);

                    // Background color off
                    backgroundColorOff.colorValue = EditorGUILayout.ColorField(
                        "Off Color",
                        toggleButton.backgroundColorOff);
                }
                else if (toggleButton.backgroundTransitionType == TransitionType.ChangeImage)
                {
                    // Background on sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("On Sprite");
                    backgroundOnSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.backgroundOnSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();

                    // Background off sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Off Sprite");
                    backgroundOffSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.backgroundOffSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    // Background off sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Sprite");
                    backgroundOffSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.backgroundOffSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();
                }


                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Lever", EditorStyles.boldLabel);

                leverTransitionType.enumValueIndex = (int)(TransitionType)
                                                     EditorGUILayout.EnumPopup(
                    "Transition Type",
                    toggleButton.leverTransitionType);

                if (toggleButton.leverTransitionType == TransitionType.ChangeColor)
                {
                    // Lever off sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Sprite");
                    leverOffSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.leverOffSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();

                    // Lever color on
                    leverColorOn.colorValue = EditorGUILayout.ColorField(
                        "On Color",
                        toggleButton.leverColorOn);

                    // Lever color off
                    leverColorOff.colorValue = EditorGUILayout.ColorField(
                        "Off Color",
                        toggleButton.leverColorOff);
                }
                else if (toggleButton.leverTransitionType == TransitionType.ChangeImage)
                {
                    // Lever on sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(
                        "On Sprite");
                    leverOnSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.leverOnSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();

                    // Lever off sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(
                        "Off Sprite");
                    leverOffSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.leverOffSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    // Lever off sprite
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Sprite");
                    leverOffSprite.objectReferenceValue = EditorGUILayout.ObjectField(
                        toggleButton.leverOffSprite,
                        typeof(Sprite),
                        true) as Sprite;
                    EditorGUILayout.EndHorizontal();
                }

                if (toggleButton.hoverEffect == ToggleButtonHoverEffect.ChangeLeverColor)
                {
                    // Lever color hovered
                    leverColorHovered.colorValue = EditorGUILayout.ColorField(
                        "Hovered Color",
                        toggleButton.leverColorHovered);
                }
                EditorGUILayout.Space();


                // On click
                EditorGUILayout.PropertyField(
                    serializedObject.FindProperty(
                        ExtraMethods.NameOf(() => toggleButton.onClick)),
                    true);

                // Allows the events to be added
                serializedObject.ApplyModifiedProperties();
            }