public override void OnInspectorGUI()
        {
            CompoundButtonMesh meshButton = (CompoundButtonMesh)target;

            GUI.color = HUXEditorUtils.DefaultColor;
            meshButton.MeshProfile = HUXEditorUtils.DrawProfileField <ButtonMeshProfile>(meshButton.MeshProfile);

            if (meshButton.MeshProfile == null)
            {
                HUXEditorUtils.SaveChanges(target);
                return;
            }

            HUXEditorUtils.BeginSectionBox("Target objects");
            meshButton.TargetTransform = HUXEditorUtils.DropDownComponentField <Transform> ("Transform", meshButton.TargetTransform, meshButton.transform);
            if (meshButton.TargetTransform != null && meshButton.TargetTransform == meshButton.transform)
            {
                HUXEditorUtils.WarningMessage("Button may behave strangely if scale & offset is applied to transform root. Consider choosing a child transform.");
            }
            else if (meshButton.TargetTransform != null)
            {
                // Check to see if offset & scale match any of the button defaults
                bool foundCloseState = false;
                foreach (CompoundButtonMesh.MeshButtonDatum datum in meshButton.MeshProfile.ButtonStates)
                {
                    if (meshButton.TargetTransform.localPosition == datum.Offset && meshButton.TargetTransform.localScale == datum.Scale)
                    {
                        foundCloseState = true;
                        break;
                    }
                }
                if (!foundCloseState)
                {
                    HUXEditorUtils.WarningMessage("Transform doesn't match the scale / offset of any button states. Button may appear different at runtime.");
                }
            }

            GUI.color           = HUXEditorUtils.DefaultColor;
            meshButton.Renderer = HUXEditorUtils.DropDownComponentField <MeshRenderer>("Mesh Renderer", meshButton.Renderer, meshButton.transform);
            //meshButton.MeshFilter = HUXEditorUtils.DropDownComponentField<MeshFilter>("Mesh Filter", meshButton.MeshFilter, meshButton.transform);

            HUXEditorUtils.EndSectionBox();

            HUXEditorUtils.BeginSectionBox("Target material properties", (meshButton.Renderer == null ? HUXEditorUtils.DisabledColor : HUXEditorUtils.DefaultColor));
            if (meshButton.Renderer == null)
            {
                HUXEditorUtils.DrawSubtleMiniLabel("(No renderer specified)");
            }
            else
            {
                meshButton.MeshProfile.ColorPropertyName = HUXEditorUtils.MaterialPropertyName(
                    meshButton.MeshProfile.ColorPropertyName,
                    meshButton.Renderer.sharedMaterial,
                    ShaderUtil.ShaderPropertyType.Color);

                meshButton.MeshProfile.ValuePropertyName = HUXEditorUtils.MaterialPropertyName(
                    meshButton.MeshProfile.ValuePropertyName,
                    meshButton.Renderer.sharedMaterial,
                    ShaderUtil.ShaderPropertyType.Float);
            }

            HUXEditorUtils.EndSectionBox();

            // Draw the profile
            HUXEditorUtils.DrawProfileInspector(meshButton.MeshProfile, meshButton);

            HUXEditorUtils.SaveChanges(target, meshButton.MeshProfile);
        }
        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.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.IconProfile;
                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()
        {
            InteractionManager interactionManager = (InteractionManager)target;

            interactionManager.RecognizableGesures = (UnityEngine.VR.WSA.Input.GestureSettings)HUXEditorUtils.EnumCheckboxField <UnityEngine.VR.WSA.Input.GestureSettings>(
                "Recognizable gestures",
                interactionManager.RecognizableGesures,
                "Default",
                UnityEngine.VR.WSA.Input.GestureSettings.Tap |
                UnityEngine.VR.WSA.Input.GestureSettings.DoubleTap |
                UnityEngine.VR.WSA.Input.GestureSettings.Hold |
                UnityEngine.VR.WSA.Input.GestureSettings.NavigationX |
                UnityEngine.VR.WSA.Input.GestureSettings.NavigationY);

            HUXEditorUtils.SaveChanges(target);
        }