/// <summary>
        /// Check and make sure we have a Mixed Reality Manager and an active profile.
        /// </summary>
        /// <returns>True if the Mixed Reality Manager is properly initialized.</returns>
        protected bool CheckMixedRealityManager(bool showHelpBox = true)
        {
            if (!MixedRealityManager.IsInitialized)
            {
                // Search the scene for one, in case we've just hot reloaded the assembly.
                var managerSearch = FindObjectsOfType <MixedRealityManager>();

                if (managerSearch.Length == 0)
                {
                    if (showHelpBox)
                    {
                        EditorGUILayout.HelpBox("No Mixed Reality Manager found in scene.", MessageType.Error);
                    }
                    return(false);
                }

                MixedRealityManager.ConfirmInitialized();
            }

            if (!MixedRealityManager.HasActiveProfile)
            {
                if (showHelpBox)
                {
                    EditorGUILayout.HelpBox("No Active Profile set on the Mixed Reality Manager.", MessageType.Error);
                }
                return(false);
            }

            return(true);
        }
예제 #2
0
        protected override void OnEnable()
        {
            base.OnEnable();

            pointerUpProperty      = serializedObject.FindProperty("onPointerUpActionEvent");
            pointerDownProperty    = serializedObject.FindProperty("onPointerDownActionEvent");
            pointerClickedProperty = serializedObject.FindProperty("onPointerClickedActionEvent");

            MixedRealityManager.ConfirmInitialized();
        }
        private void OnEnable()
        {
            configurationProfile = target as MixedRealityConfigurationProfile;

            // Create The MR Manager if none exists.
            if (!MixedRealityManager.IsInitialized)
            {
                // Search the scene for one, in case we've just hot reloaded the assembly.
                var managerSearch = FindObjectsOfType <MixedRealityManager>();

                if (managerSearch.Length == 0)
                {
                    if (EditorUtility.DisplayDialog(
                            "Attention!",
                            "There is no active Mixed Reality Manager in your scene!\n\nWould you like to create one now?",
                            "Yes",
                            "Later"))
                    {
                        MixedRealityManager.Instance.ActiveProfile = configurationProfile;
                    }
                    else
                    {
                        Debug.LogWarning("No Mixed Reality Manager in your scene.");
                        return;
                    }
                }
            }

            if (!MixedRealityManager.ConfirmInitialized())
            {
                return;
            }

            if (!MixedRealityManager.HasActiveProfile)
            {
                return;
            }

            // Experience configuration
            targetExperienceScale = serializedObject.FindProperty("targetExperienceScale");
            // Camera configuration
            enableCameraProfile = serializedObject.FindProperty("enableCameraProfile");
            cameraProfile       = serializedObject.FindProperty("cameraProfile");
            // Input system configuration
            enableInputSystem          = serializedObject.FindProperty("enableInputSystem");
            inputSystemType            = serializedObject.FindProperty("inputSystemType");
            inputActionsProfile        = serializedObject.FindProperty("inputActionsProfile");
            pointerProfile             = serializedObject.FindProperty("pointerProfile");
            enableSpeechCommands       = serializedObject.FindProperty("enableSpeechCommands");
            speechCommandsProfile      = serializedObject.FindProperty("speechCommandsProfile");
            recognitionConfidenceLevel = serializedObject.FindProperty("recognitionConfidenceLevel");
            enableDictation            = serializedObject.FindProperty("enableDictation");
            enableTouchScreenInput     = serializedObject.FindProperty("enableTouchScreenInput");
            touchScreenInputProfile    = serializedObject.FindProperty("touchScreenInputProfile");
            enableControllerMapping    = serializedObject.FindProperty("enableControllerMapping");
            controllerMappingProfile   = serializedObject.FindProperty("controllerMappingProfile");
            // Boundary system configuration
            enableBoundarySystem = serializedObject.FindProperty("enableBoundarySystem");
            boundarySystemType   = serializedObject.FindProperty("boundarySystemType");
            boundaryHeight       = serializedObject.FindProperty("boundaryHeight");
            // Teleport system configuration
            enableTeleportSystem         = serializedObject.FindProperty("enableTeleportSystem");
            teleportSystemType           = serializedObject.FindProperty("teleportSystemType");
            teleportDuration             = serializedObject.FindProperty("teleportDuration");
            boundaryVisualizationProfile = serializedObject.FindProperty("boundaryVisualizationProfile");
        }