Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            BoundingBoxTarget bbt = (BoundingBoxTarget)target;

            // See if there's a bounding box yet
            BoundingBoxManipulate bbm = GameObject.FindObjectOfType <BoundingBoxManipulate>();
            AppBar toolbar            = GameObject.FindObjectOfType <AppBar>();

            if (bbm == null || toolbar == null)
            {
                HUXEditorUtils.ErrorMessage(
                    "Couldn't find a bounding box prefab and/or manipulation toolbar in the scene. Bounding box target won't work without them.",
                    AddBoundingBox);
            }

            HUXEditorUtils.DrawFilterTagField(serializedObject, "TagOnSelected");
            HUXEditorUtils.DrawFilterTagField(serializedObject, "TagOnDeselected");
            bbt.PermittedOperations = (BoundingBoxManipulate.OperationEnum)HUXEditorUtils.EnumCheckboxField <BoundingBoxManipulate.OperationEnum>(
                "Permitted Operations",
                bbt.PermittedOperations,
                "Default",
                BoundingBoxManipulate.OperationEnum.ScaleUniform | BoundingBoxManipulate.OperationEnum.RotateY | BoundingBoxManipulate.OperationEnum.Drag,
                BoundingBoxManipulate.OperationEnum.Drag);

            bbt.ShowAppBar = EditorGUILayout.Toggle("Toolbar Display", bbt.ShowAppBar);


            HUXEditorUtils.SaveChanges(bbt);
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            CompoundButtonSpeech speechButton = (CompoundButtonSpeech)target;

            bool microphoneEnabled = PlayerSettings.WSA.GetCapability(PlayerSettings.WSACapability.Microphone);

            if (!microphoneEnabled)
            {
                HUXEditorUtils.WarningMessage("Microphone capability not present. Speech recognition will be disabled.", "Enable Microphone Capability", EnableMicrophone);
                HUXEditorUtils.SaveChanges(target);
                return;
            }

            HUXEditorUtils.BeginSectionBox("Keyword source");
            speechButton.KeywordSource = (CompoundButtonSpeech.KeywordSourceEnum)EditorGUILayout.EnumPopup(speechButton.KeywordSource);
            CompoundButtonText text = speechButton.GetComponent <CompoundButtonText>();

            switch (speechButton.KeywordSource)
            {
            case CompoundButtonSpeech.KeywordSourceEnum.ButtonText:
            default:
                if (text == null)
                {
                    HUXEditorUtils.ErrorMessage("No CompoundButtonText component found.", AddText);
                }
                else if (string.IsNullOrEmpty(text.Text))
                {
                    HUXEditorUtils.WarningMessage("No keyword found in button text.");
                }
                else
                {
                    EditorGUILayout.LabelField("Keyword: " + text.Text);
                }
                break;

            case CompoundButtonSpeech.KeywordSourceEnum.LocalOverride:
                speechButton.Keyword = EditorGUILayout.TextField(speechButton.Keyword);
                break;

            case CompoundButtonSpeech.KeywordSourceEnum.None:
                HUXEditorUtils.DrawSubtleMiniLabel("(Speech control disabled)");
                break;
            }
            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.SaveChanges(target);
        }
        public override void OnInspectorGUI()
        {
            CompoundButtonSpeech speechButton = (CompoundButtonSpeech)target;

            HUXEditorUtils.BeginSectionBox("Keyword source");
            speechButton.KeywordSource = (CompoundButtonSpeech.KeywordSourceEnum)EditorGUILayout.EnumPopup(speechButton.KeywordSource);
            CompoundButtonText text = speechButton.GetComponent <CompoundButtonText>();

            switch (speechButton.KeywordSource)
            {
            case CompoundButtonSpeech.KeywordSourceEnum.ButtonText:
            default:
                if (text == null)
                {
                    HUXEditorUtils.ErrorMessage("No CompoundButtonText component found.", AddText);
                }
                else if (string.IsNullOrEmpty(text.Text))
                {
                    HUXEditorUtils.WarningMessage("No keyword found in button text.");
                }
                else
                {
                    EditorGUILayout.LabelField("Keyword: " + text.Text);
                }
                break;

            case CompoundButtonSpeech.KeywordSourceEnum.LocalOverride:
                speechButton.Keyword = EditorGUILayout.TextField(speechButton.Keyword);
                break;

            case CompoundButtonSpeech.KeywordSourceEnum.None:
                HUXEditorUtils.DrawSubtleMiniLabel("(Speech control disabled)");
                break;
            }
            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.SaveChanges(target);
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            AppBar appBar = (AppBar)target;

            appBar.DisplayType = (AppBar.AppBarDisplayTypeEnum)EditorGUILayout.EnumPopup("Display Type", appBar.DisplayType);

            if (appBar.DisplayType == AppBar.AppBarDisplayTypeEnum.Manipulation)
            {
                HUXEditorUtils.BeginSectionBox("Bounding box");
                appBar.BoundingBox = HUXEditorUtils.SceneObjectField <BoundingBoxManipulate>(null, appBar.BoundingBox);
                if (appBar.BoundingBox == null)
                {
                    HUXEditorUtils.WarningMessage("Manipulation state will not function correctly at runtime without a bounding box. (If you're using BoundingBoxTarget this is not a problem.)");
                }
                HUXEditorUtils.EndSectionBox();
            }

            HUXEditorUtils.BeginSectionBox("App bar options");
            appBar.HoverOffsetYScale  = EditorGUILayout.Slider("Hover Offset (Y)", appBar.HoverOffsetYScale, -1f, 2f);
            appBar.HoverOffsetZ       = EditorGUILayout.Slider("Hover Offset (Z)", appBar.HoverOffsetZ, 0f, 2f);
            appBar.SquareButtonPrefab = (GameObject)EditorGUILayout.ObjectField("Button Prefab", appBar.SquareButtonPrefab, typeof(GameObject));
            GUI.color = (appBar.CustomButtonIconProfile == null) ? HUXEditorUtils.DisabledColor : HUXEditorUtils.DefaultColor;
            appBar.CustomButtonIconProfile = (ButtonIconProfile)EditorGUILayout.ObjectField("Custom Icon Profile", appBar.CustomButtonIconProfile, typeof(ButtonIconProfile));
            HUXEditorUtils.DrawSubtleMiniLabel("(Leave blank to use the button's default profile)");
            GUI.color = HUXEditorUtils.DefaultColor;

            if (appBar.SquareButtonPrefab == null)
            {
                HUXEditorUtils.ErrorMessage("You must specify a button prefab");
                HUXEditorUtils.EndSectionBox();
                return;
            }

            CompoundButtonIcon icon = appBar.SquareButtonPrefab.GetComponent <CompoundButtonIcon>();

            if (icon == null)
            {
                HUXEditorUtils.ErrorMessage("You must use a button prefab that has a CompoundButtonIcon component");
                HUXEditorUtils.EndSectionBox();
                return;
            }

            HUXEditorUtils.BeginSubSectionBox("Default buttons");
            GUI.color        = appBar.UseHide ? HUXEditorUtils.DefaultColor : HUXEditorUtils.DisabledColor;
            appBar.UseHide   = EditorGUILayout.Toggle("Show / Hide Buttons", appBar.UseHide);
            GUI.color        = appBar.UseAdjust ? HUXEditorUtils.DefaultColor : HUXEditorUtils.DisabledColor;
            appBar.UseAdjust = EditorGUILayout.Toggle("Adjust / Done Buttons", appBar.UseAdjust);
            GUI.color        = appBar.UseRemove ? HUXEditorUtils.DefaultColor : HUXEditorUtils.DisabledColor;
            appBar.UseRemove = EditorGUILayout.Toggle("Remove Button", appBar.UseRemove);
            GUI.color        = HUXEditorUtils.DefaultColor;
            HUXEditorUtils.EndSubSectionBox();

            HUXEditorUtils.BeginSubSectionBox("Custom buttons");
            HUXEditorUtils.DrawSubtleMiniLabel("Up to " + AppBar.MaxCustomButtons + " allowed. Un-named buttons will be ignored.");
            //HUXEditorUtils.DrawProfileField <ButtonIconProfile> (appBar.CustomButtonIconProfile)

            // Get the profile we'll be using for our icons
            ButtonIconProfile profile = appBar.CustomButtonIconProfile;

            if (profile == null)
            {
                profile = icon.Profile;
                if (profile == null)
                {
                    HUXEditorUtils.ErrorMessage("The button prefab does not specify an icon profile. Can't continue.");
                    HUXEditorUtils.EndSectionBox();
                    return;
                }
            }

            AppBar.ButtonTemplate[] buttons = appBar.Buttons;
            if (buttons.Length != AppBar.MaxCustomButtons)
            {
                System.Array.Resize <AppBar.ButtonTemplate>(ref buttons, AppBar.MaxCustomButtons);
            }
            int numCustomButtons = appBar.UseHide ? 0 : -1;

            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i] = DrawButtonEditor(buttons[i], profile, ref numCustomButtons, "buttons", i);
            }
            appBar.Buttons = buttons;
            HUXEditorUtils.EndSubSectionBox();

            // Force the buttons to refresh based on the options we've specified
            appBar.EditorRefreshTemplates();

            HUXEditorUtils.BeginSubSectionBox("App bar preview");
            HUXEditorUtils.DrawSubtleMiniLabel("An approximation of what the final bar will look like. 'Hidden' and 'Manipulation' states depend on default button settings and may not be available.");
            previewState = (AppBar.AppBarStateEnum)EditorGUILayout.EnumPopup(previewState);
            List <AppBar.ButtonTemplate> buttonList = new List <AppBar.ButtonTemplate>();

            buttonList.AddRange(appBar.DefaultButtons);
            buttonList.AddRange(buttons);

            if (previewState == AppBar.AppBarStateEnum.Default)
            {
                buttonList.Sort(delegate(AppBar.ButtonTemplate b1, AppBar.ButtonTemplate b2) { return(b1.DefaultPosition.CompareTo(b2.DefaultPosition)); });
            }
            else
            {
                buttonList.Sort(delegate(AppBar.ButtonTemplate b1, AppBar.ButtonTemplate b2) { return(b1.ManipulationPosition.CompareTo(b2.ManipulationPosition)); });
            }


            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.MaxHeight(previewButtonSize + 15f));
            EditorGUILayout.BeginHorizontal();
            bool drewOneButton = false;

            for (int i = 0; i < buttonList.Count; i++)
            {
                drewOneButton |= DrawPreviewButton(buttonList[i], previewState, appBar.UseHide, appBar.UseAdjust, appBar.UseRemove);
            }
            if (!drewOneButton)
            {
                HUXEditorUtils.WarningMessage("This state has no buttons due to the options you've chosen. It won't be permitted during play mode.");
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndScrollView();

            HUXEditorUtils.EndSubSectionBox();

            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.SaveChanges(appBar);
        }
        public override void OnInspectorGUI()
        {
            CompoundButtonIcon iconButton = (CompoundButtonIcon)target;

            iconButton.DisableIcon = EditorGUILayout.Toggle("Disable icon", iconButton.DisableIcon);
            if (iconButton.DisableIcon)
            {
                HUXEditorUtils.SaveChanges(target);
                return;
            }

            profileProp.objectReferenceValue = HUXEditorUtils.DrawProfileField <ButtonIconProfile>(profileProp.objectReferenceValue as ButtonIconProfile);
            //iconButton.Profile = HUXEditorUtils.DrawProfileField<ButtonIconProfile>(iconButton.Profile);

            if (iconButton.Profile == null)
            {
                HUXEditorUtils.SaveChanges(target);
                return;
            }

            HUXEditorUtils.BeginSectionBox("Icon settings");
            if (UnityEditor.Selection.gameObjects.Length == 1)
            {
                iconButton.IconRenderer = HUXEditorUtils.DropDownComponentField <MeshRenderer>("Icon renderer", iconButton.IconRenderer, iconButton.transform);

                if (iconButton.IconRenderer == null)
                {
                    HUXEditorUtils.ErrorMessage("You must specify an icon renderer", null);
                    HUXEditorUtils.EndSectionBox();
                    HUXEditorUtils.SaveChanges(target);
                    return;
                }

                if (iconButton.Profile.IconMaterial == null)
                {
                    HUXEditorUtils.ErrorMessage("You must specify an icon material in the profile", null);
                    HUXEditorUtils.EndSectionBox();
                    HUXEditorUtils.SaveChanges(target);
                    return;
                }

                if (iconButton.Profile.IconMesh == null)
                {
                    HUXEditorUtils.ErrorMessage("You must specify an icon mesh in the profile", null);
                    HUXEditorUtils.EndSectionBox();
                    HUXEditorUtils.SaveChanges(target);
                    return;
                }
                // Icon profiles provide their own fields for the icon name
                iconButton.Alpha = EditorGUILayout.Slider("Icon transparency", iconButton.Alpha, 0f, 1f);

                iconButton.IconName = iconButton.Profile.DrawIconSelectField(iconButton.IconName);
            }
            else
            {
                EditorGUILayout.LabelField("(This section not supported for multiple objects)", EditorStyles.miniLabel);
            }

            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.DrawProfileInspector(iconButton.Profile, iconButton);

            // Check to see if the icon is valid - if it's not, show the placeholder

            /*Texture2D icon = iconButton.IconRenderer.sharedMaterial.mainTexture as Texture2D;
             * if (icon == null || icon == iconButton.IconProfile._IconNotFound_)
             * {
             *  HUXEditorUtils.WarningMessage(
             *      "Texture '" + iconButton.IconName + "' was not found in the selected profile. A substitute will be displayed until an icon file has been added to the profile.",
             *      "Click to open profile",
             *      ClickToOpen);
             * }*/

            HUXEditorUtils.SaveChanges(iconButton, iconButton.Profile);
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 6
0
        public override void OnInspectorGUI()
        {
            ButtonIconProfileFont iconProfile = (ButtonIconProfileFont)target;

            //CompoundButtonIcon iconButton = (CompoundButtonIcon)targetComponent;

            HUXEditorUtils.BeginProfileBox();

            HUXEditorUtils.BeginSectionBox(ButtonIconProfileFont.DefaultUnicodeFont + " font asset");
            EditorGUILayout.BeginHorizontal();
            Font font = (Font)EditorGUILayout.ObjectField(iconProfile.IconFont, typeof(Font), false);

            EditorGUILayout.EndHorizontal();
            if (font == null)
            {
                HUXEditorUtils.ErrorMessage(
                    "You must assign the '" + ButtonIconProfileFont.DefaultUnicodeFont + "' font for this profile to work. (If the font is installed, clicking 'Auto-assign' will find it for you.)",
                    SearchForFont,
                    "Auto-assign '" + ButtonIconProfileFont.DefaultUnicodeFont + "' font");
                if (GUILayout.Button("Download '" + ButtonIconProfileFont.DefaultUnicodeFont + "' font"))
                {
                    Application.OpenURL(StartupChecks.RequiredFontURL);
                }
            }
            else
            {
                bool correctFontName = false;
                foreach (string fontName in font.fontNames)
                {
                    if (fontName.Equals(ButtonIconProfileFont.DefaultUnicodeFont))
                    {
                        correctFontName = true;
                        break;
                    }
                }
                if (correctFontName)
                {
                    // We've got the right font, now check its properties
                    iconProfile.IconFont = font;
                    if (!font.dynamic)
                    {
                        HUXEditorUtils.ErrorMessage("Font character mode must be set to 'Dynamic'", SelectFontAsset, "Click to open font asset");
                    }
                }
                else
                {
                    // This is the wrong font, don't use it
                    iconProfile.IconFont = null;
                }
            }
            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.BeginSectionBox("Material & mesh properties");
            iconProfile._IconNotFound_       = (Texture2D)EditorGUILayout.ObjectField("Icon not found texture", iconProfile._IconNotFound_, typeof(Texture2D), false, GUILayout.MaxHeight(35f), GUILayout.MaxHeight(35f));
            iconProfile.IconMesh             = (Mesh)EditorGUILayout.ObjectField("Icon mesh", iconProfile.IconMesh, typeof(Mesh), false);
            iconProfile.IconMaterial         = (Material)EditorGUILayout.ObjectField("Icon material", iconProfile.IconMaterial, typeof(Material), false);
            iconProfile.AlphaColorProperty   = HUXEditorUtils.MaterialPropertyName(iconProfile.AlphaColorProperty, iconProfile.IconMaterial, ShaderUtil.ShaderPropertyType.Color);
            iconProfile.AlphaTransitionSpeed = EditorGUILayout.Slider("Alpha Transition Speed", iconProfile.AlphaTransitionSpeed, 0f, 2f);
            iconProfile.FontScaleFactor      = EditorGUILayout.IntField("Font scale factor", iconProfile.FontScaleFactor);
            iconProfile.RendererScale        = EditorGUILayout.FloatField("Renderer scale", iconProfile.RendererScale);
            HUXEditorUtils.EndSectionBox();

            #region font selection

            //iconProfile.FontSize = EditorGUILayout.IntField("Size", Mathf.Clamp (iconProfile.FontSize, 10, 300));

            /*string[] osInstalledFontNames = Font.GetOSInstalledFontNames();
             * int huxIconFontNameIndex = -1;
             * for (int i = 0; i < osInstalledFontNames.Length; i++)
             * {
             *  if (osInstalledFontNames[i] == ButtonIconProfileFont.DefaultUnicodeFont)
             *  {
             *      huxIconFontNameIndex = i;
             *  }
             * }
             *
             * if (huxIconFontNameIndex < 0)
             * {
             *  HUXEditorUtils.ErrorMessage("Couldn't find font '" + ButtonIconProfileFont.DefaultUnicodeFont + "'", null);
             * }
             * else if (GUILayout.Button("Click to select '" + ButtonIconProfileFont.DefaultUnicodeFont + "'"))
             * {
             *  iconProfile.OSFontName = osInstalledFontNames[huxIconFontNameIndex];
             * }
             *
             * HUXEditorUtils.EndSectionBox();*/

            #endregion

            HUXEditorUtils.EndProfileBox();

            HUXEditorUtils.SaveChanges(this);
        }
Ejemplo n.º 7
0
        public override void OnInspectorGUI()
        {
            SimpleMenuCollection menu = (SimpleMenuCollection)target;

            HUXEditorUtils.BeginSectionBox("Menu settings");

            menu.DisplayTitle = EditorGUILayout.Toggle("Display Title", menu.DisplayTitle);
            if (menu.DisplayTitle)
            {
                //menu.TitleText.font = (Font)EditorGUILayout.ObjectField("Title font", menu.TitleText.font, typeof(Font), false);
                menu.Title     = EditorGUILayout.TextArea(menu.Title);
                menu.TitleText = HUXEditorUtils.DropDownComponentField <TextMesh>("Title TextMesh", menu.TitleText, menu.transform);
            }

            menu.DisplaySubtitle = EditorGUILayout.Toggle("Display Subtitle", menu.DisplaySubtitle);
            if (menu.DisplaySubtitle)
            {
                //menu.TitleText.font = (Font)EditorGUILayout.ObjectField("Title font", menu.TitleText.font, typeof(Font), false);
                menu.Subtitle     = EditorGUILayout.TextArea(menu.Subtitle);
                menu.SubtitleText = HUXEditorUtils.DropDownComponentField <TextMesh>("Subtitle TextMesh", menu.SubtitleText, menu.transform);
            }
            menu.ButtonPrefab     = (GameObject)EditorGUILayout.ObjectField("Button prefab", menu.ButtonPrefab, typeof(GameObject), false);
            menu.ParentCollection = HUXEditorUtils.DropDownComponentField <ObjectCollection>("Collection parent", menu.ParentCollection, menu.transform);

            if (menu.ButtonPrefab == null)
            {
                HUXEditorUtils.ErrorMessage("You must specify a button prefab");
                HUXEditorUtils.EndSectionBox();
                return;
            }

            if (menu.ParentCollection == null)
            {
                HUXEditorUtils.ErrorMessage("This menu needs a collection component to work", AddCollection, "Fix");
                HUXEditorUtils.EndSectionBox();
                return;
            }

            bool showIcon = false;
            bool showText = false;

            CompoundButtonIcon icon = menu.ButtonPrefab.GetComponent <CompoundButtonIcon>();

            showIcon = icon != null;


            CompoundButtonText text = menu.ButtonPrefab.GetComponent <CompoundButtonText>();

            showText = text != null;

            ButtonIconProfile profile = null;

            if (icon != null)
            {
                profile = icon.IconProfile;
            }

            HUXEditorUtils.BeginSubSectionBox("Buttons");
            HUXEditorUtils.DrawSubtleMiniLabel("Up to " + SimpleMenuCollection.MaxButtons + " allowed. Un-named buttons will be ignored.");

            SimpleMenuCollectionButton[] buttons          = menu.Buttons;
            HashSet <string>             buttonNamesSoFar = new HashSet <string>();
            int numButtons = 0;

            for (int i = 0; i < buttons.Length; i++)
            {
                if (!buttons[i].IsEmpty)
                {
                    numButtons++;
                }
                DrawButtonEditor(buttons[i], showIcon, showText, profile, "buttons", i, buttonNamesSoFar);
            }
            HUXEditorUtils.EndSubSectionBox();

            menu.EditorRefreshButtons();

            HUXEditorUtils.BeginSubSectionBox("Menu preview");
            HUXEditorUtils.DrawSubtleMiniLabel("An approximation of what the menu will look like.");

            List <SimpleMenuCollectionButton> buttonsList = new List <SimpleMenuCollectionButton>(buttons);

            buttonsList.Sort(delegate(SimpleMenuCollectionButton b1, SimpleMenuCollectionButton b2) { return(b1.Index.CompareTo(b2.Index)); });

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, false, false, GUILayout.MinHeight(previewButtonSizeY * numButtons + 50f));
            EditorGUILayout.BeginVertical();
            bool drewOneButton = false;

            foreach (SimpleMenuCollectionButton button in buttonsList)
            {
                drewOneButton |= DrawPreviewButton(button, showText);
            }
            if (!drewOneButton)
            {
                HUXEditorUtils.WarningMessage("This state has no buttons due to the options you've chosen. It won't be permitted during play mode.");
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();

            HUXEditorUtils.EndSubSectionBox();

            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.SaveChanges(menu);
        }
Ejemplo n.º 8
0
        private void DrawButtonEditor(SimpleMenuCollectionButton template, bool showIcon, bool showText, ButtonIconProfile profile, string arrayName, int templateIndex, HashSet <string> buttonNamesSoFar)
        {
            if (!string.IsNullOrEmpty(template.Name))
            {
                HUXEditorUtils.BeginSectionBox(template.Name + " (" + template.Index + ")", HUXEditorUtils.ObjectColor);
            }
            else
            {
                HUXEditorUtils.BeginSectionBox(string.Empty, HUXEditorUtils.ObjectColorEmpty);
            }
            GUI.color = template.IsEmpty ? HUXEditorUtils.DisabledColor : HUXEditorUtils.DefaultColor;
            EditorGUILayout.BeginHorizontal();
            template.Name = EditorGUILayout.TextField(string.IsNullOrEmpty(template.Name) ? "Button Name (Empty)" : "Button Name", template.Name);
            if (GUILayout.Button("Clear", EditorStyles.miniButton))
            {
                template.Name = string.Empty;
            }
            EditorGUILayout.EndHorizontal();
            if (!string.IsNullOrEmpty(template.Name) && buttonNamesSoFar.Contains(template.Name))
            {
                HUXEditorUtils.ErrorMessage("Buttons must have unique names.");
            }
            else
            {
                buttonNamesSoFar.Add(template.Name);
            }
            if (!template.IsEmpty)
            {
                if (showText)
                {
                    if (string.IsNullOrEmpty(template.Text))
                    {
                        GUI.color = HUXEditorUtils.WarningColor;
                    }
                    template.Text = EditorGUILayout.TextField("Label Text", template.Text);
                }

                if (showIcon)
                {
                    GUI.color = HUXEditorUtils.DefaultColor;
                    string[] keys          = profile.GetIconKeys().ToArray();
                    int      selectedIndex = 0;
                    for (int i = 0; i < keys.Length; i++)
                    {
                        if (keys[i].Equals(template.Icon))
                        {
                            selectedIndex = i;
                            break;
                        }
                    }
                    selectedIndex = EditorGUILayout.Popup("Icon", selectedIndex, keys);
                    template.Icon = keys[selectedIndex];
                }

                if (!Application.isPlaying)
                {
                    template.Target = HUXEditorUtils.SceneObjectField <InteractionReceiver>("Interaction Receiver", template.Target);
                    if (template.Target == null)
                    {
                        HUXEditorUtils.WarningMessage("This button will have no effect until you choose an interaction receiver to register it with.");
                    }
                }
            }

            // Draw the unity message section

            /*string propertyName = string.Format("{0}.Array.data[{1}].OnTappedEvent", arrayName, templateIndex);
             * SerializedProperty buttonEvent = serializedObject.FindProperty(propertyName);
             * EditorGUILayout.PropertyField(buttonEvent);
             * if (GUI.changed) {
             *  serializedObject.ApplyModifiedProperties();
             * }*/

            HUXEditorUtils.EndSectionBox();
        }
        public override void OnInspectorGUI()
        {
            CompoundButtonToggle toggle = (CompoundButtonToggle)target;

            HUXEditorUtils.BeginSectionBox("Target");

            toggle.Target = HUXEditorUtils.DropDownComponentField <MonoBehaviour>("Component", toggle.Target, toggle.transform, true);
            FieldInfo fieldInfo   = null;
            Type      profileType = null;

            if (toggle.Target == null)
            {
                HUXEditorUtils.ErrorMessage("Target must be set.");
                HUXEditorUtils.EndSectionBox();
                HUXEditorUtils.SaveChanges(target, serializedObject);
                return;
            }
            else
            {
                fieldInfo = toggle.Target.GetType().GetField("Profile");

                if (fieldInfo == null)
                {
                    HUXEditorUtils.ErrorMessage("Target component has no 'Profile' field - are you use this class inherits from ProfileButtonBase?");
                    HUXEditorUtils.EndSectionBox();
                    HUXEditorUtils.SaveChanges(target, serializedObject);
                    return;
                }

                GUIStyle labelStyle = new GUIStyle(EditorStyles.label);
                labelStyle.fontSize  = 18;
                labelStyle.fontStyle = FontStyle.Bold;

                profileType = fieldInfo.FieldType;
                EditorGUILayout.LabelField("Type: " + toggle.Target.GetType().Name + " / " + fieldInfo.FieldType.Name, labelStyle, GUILayout.MinHeight(24));
            }
            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.BeginSectionBox("Toggling");
            HUXEditorUtils.DrawSubtleMiniLabel("Select on/off profiles of the type " + profileType.Name);
            if (toggle.OnProfile == null)
            {
                toggle.OnProfile = (ButtonProfile)fieldInfo.GetValue(toggle.Target);
            }
            if (toggle.OffProfile == null)
            {
                toggle.OffProfile = toggle.OnProfile;
            }
            ButtonProfile onProfile  = (ButtonProfile)EditorGUILayout.ObjectField("On Profile", toggle.OnProfile, typeof(ButtonProfile), false);
            ButtonProfile offProfile = (ButtonProfile)EditorGUILayout.ObjectField("Off Profile", toggle.OffProfile, typeof(ButtonProfile), false);

            if (onProfile.GetType() == profileType)
            {
                toggle.OnProfile = onProfile;
            }
            if (offProfile.GetType() == profileType)
            {
                toggle.OffProfile = offProfile;
            }

            if (toggle.OnProfile.GetType() != profileType)
            {
                HUXEditorUtils.ErrorMessage("On profile object does not match type " + profileType.Name);
            }
            if (toggle.OffProfile.GetType() != profileType)
            {
                HUXEditorUtils.ErrorMessage("Off profile object does not match type " + profileType.Name);
            }

            if (onProfile == offProfile)
            {
                HUXEditorUtils.WarningMessage("Profiles are the same - toggle will have no effect");
            }

            toggle.Behavior = (CompoundButtonToggle.ToggleBehaviorEnum)EditorGUILayout.EnumPopup("Toggle behavior", toggle.Behavior);
            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.BeginSectionBox("State");
            if (!Application.isPlaying)
            {
                toggle.State = EditorGUILayout.Toggle(toggle.State);
            }
            else
            {
                EditorGUILayout.Toggle(toggle.State);
            }
            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.SaveChanges(target, serializedObject);
        }