示例#1
0
        private IEnumerator RestartCoroutine(bool shouldRestart)
        {
            try
            {
                yield return(null);

                // Always shutdown the loader
                XRGeneralSettings.Instance.Manager.DeinitializeLoader();
                yield return(null);

                onAfterShutdown?.Invoke();

                // Restart?
                if (shouldRestart && OpenXRRuntime.ShouldRestart())
                {
                    yield return(XRGeneralSettings.Instance.Manager.InitializeLoader());

                    XRGeneralSettings.Instance.Manager.StartSubsystems();

                    if (XRGeneralSettings.Instance.Manager.activeLoader == null)
                    {
                        Debug.LogError("Failure to restart OpenXRLoader after shutdown.");
                    }

                    onAfterRestart?.Invoke();
                }
                // Quit?
                else if (OpenXRRuntime.ShouldQuit())
                {
                    onQuit?.Invoke();
#if !UNITY_INCLUDE_TESTS
#if UNITY_EDITOR
                    if (EditorApplication.isPlaying || EditorApplication.isPaused)
                    {
                        EditorApplication.ExitPlaymode();
                    }
#else
                    Application.Quit();
#endif
#endif
                }
            }
            finally
            {
                m_Coroutine = null;
                onAfterCoroutine?.Invoke();
            }
        }
示例#2
0
        private static void DebugLogEnabledSpecExtensions()
        {
            var section = DiagnosticReport.GetSection("OpenXR Runtime Info");

            DiagnosticReport.AddSectionBreak(section);

            var extensions = OpenXRRuntime.GetEnabledExtensions();
            var log        = new StringBuilder($"({extensions.Length})\n");

            foreach (var extension in extensions)
            {
                log.Append($"  Name={extension} Version={OpenXRRuntime.GetExtensionVersion(extension)}\n");
            }

            DiagnosticReport.AddSectionEntry(section, "Spec extensions enabled", log.ToString());
        }
示例#3
0
        public static void SendInitializeEvent(bool success)
        {
#if UNITY_ANALYTICS
            if (!s_Initialized && !Initialize())
            {
                return;
            }

            var data = new InitializeEvent
            {
                success            = success,
                runtime            = OpenXRRuntime.name,
                runtime_version    = OpenXRRuntime.version,
                plugin_version     = OpenXRRuntime.pluginVersion,
                api_version        = OpenXRRuntime.apiVersion,
                enabled_extensions = OpenXRRuntime.GetEnabledExtensions()
                                     .Select(ext => $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}")
                                     .ToArray(),
                available_extensions = OpenXRRuntime.GetAvailableExtensions()
                                       .Select(ext => $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}")
                                       .ToArray(),
                enabled_features = OpenXRSettings.Instance.features
                                   .Where(f => f != null && f.enabled)
                                   .Select(f => $"{f.GetType().FullName}_{f.version}").ToArray(),
                failed_features = OpenXRSettings.Instance.features
                                  .Where(f => f != null && f.failedInitialization)
                                  .Select(f => $"{f.GetType().FullName}_{f.version}").ToArray()
            };

#if UNITY_EDITOR
            EditorAnalytics.SendEventWithLimit(kEventInitialize, data);
#else
            Analytics.Analytics.SendEvent(kEventInitialize, data);
#endif
#endif
        }