Exemplo n.º 1
0
        public void Dispose()
        {
            if (m_Instance == null)
            {
                return;
            }

            if (m_CameraRig && Application.isPlaying)
            {
                UnityObjectUtils.Destroy(m_CameraRig.gameObject);
            }

            m_Instance.Shutdown(); // Give a chance for dependent systems (e.g. serialization) to shut-down before destroying
            m_Instance = null;
        }
Exemplo n.º 2
0
        // ReSharper disable once UnusedMember.Local
        static void PreferencesGUI()
        {
            EditorGUILayout.BeginVertical();

            // Show EditorXR GameObjects
            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                const string title   = "Show EditorXR GameObjects";
                const string tooltip = "Normally, EditorXR GameObjects are hidden in the Hierarchy. Would you like to show them?";

                var debugSettings   = ModuleLoaderDebugSettings.instance;
                var hideFlags       = debugSettings.moduleHideFlags;
                var showGameObjects = (hideFlags & HideFlags.HideInHierarchy) == 0;
                showGameObjects = EditorGUILayout.Toggle(new GUIContent(title, tooltip), showGameObjects);
                if (changed.changed)
                {
                    debugSettings.SetModuleHideFlags(showGameObjects ? hideFlags & ~HideFlags.HideInHierarchy : hideFlags | HideFlags.HideInHierarchy);
                }
            }

            // Preserve Layout
            {
                const string title   = "Preserve Layout";
                const string tooltip = "Check this to preserve your layout and location in EditorXR";
                EditorXR.preserveLayout = EditorGUILayout.Toggle(new GUIContent(title, tooltip), EditorXR.preserveLayout);
            }

            // Include in Builds
            {
                const string title   = "Include in Player Builds";
                const string tooltip = "Normally, EditorXR will only be available in the editor. Check this if you would like to modify its assembly definitions and include it in player builds";
                EditorXR.includeInBuilds = EditorGUILayout.Toggle(new GUIContent(title, tooltip), EditorXR.includeInBuilds);
            }

            if (GUILayout.Button("Reset to Defaults", GUILayout.Width(140)))
            {
                EditorXR.ResetPreferences();
            }

            EditorGUILayout.EndVertical();
        }
Exemplo n.º 3
0
        public void Setup()
        {
#if UNITY_EDITOR
            SetupMonoScriptTypeNames();
#endif

            EditorXR.DefaultMenu          = GetTypeSafe(m_DefaultMainMenuName);
            EditorXR.DefaultAlternateMenu = GetTypeSafe(m_DefaultAlternateMenuName);

            if (m_DefaultToolStackNames != null)
            {
                EditorXR.DefaultTools = m_DefaultToolStackNames.Select(GetTypeSafe).ToArray();
            }

            if (m_HiddenTypeNames != null)
            {
                EditorXR.HiddenTypes = m_HiddenTypeNames.Select(GetTypeSafe).ToArray();
            }

            if (Application.isPlaying)
            {
                var camera = CameraUtils.GetMainCamera();
                VRView.CreateCameraRig(ref camera, out m_CameraRig);
            }

            m_Instance = ModuleLoaderCore.instance.GetModule <EditorXR>();
            if (m_Instance == null)
            {
                Debug.LogWarning("EditorXR Module not loaded");
                return;
            }

            m_Instance.Initialize();

            XRSettings.eyeTextureResolutionScale = m_RenderScale;
        }