示例#1
0
        IEnumerator Restart(OpenXRLoaderBase loader, bool shouldRestart, Action shutdownCallback, Action restartCallback)
        {
            XRGeneralSettings.Instance.Manager.StopSubsystems();
            yield return(null);

            XRGeneralSettings.Instance.Manager.DeinitializeLoader();
            yield return(null);

            shutdownCallback();

            if (shouldRestart)
            {
                yield return(XRGeneralSettings.Instance.Manager.InitializeLoader());

                yield return(null);

                XRGeneralSettings.Instance.Manager.StartSubsystems();
                yield return(null);

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

                restartCallback();
            }

            GameObject.Destroy(gameObject);
        }
示例#2
0
 static void CreateRestarter(OpenXRLoaderBase loader, bool shouldRestart)
 {
     if (shouldRestart)
     {
         loader.GetRestarter().ShutdownAndRestartLoader(loader,
                                                        () => { loader.ShutdownCompleted(); },
                                                        () => { loader.RestartCompleted(); });
     }
     else
     {
         loader.GetRestarter().ShutdownLoader(loader,
                                              () => { loader.ShutdownCompleted(); });
     }
 }
示例#3
0
 internal void ShutdownAndRestartLoader(OpenXRLoaderBase loader, Action shutdownCallback, Action restartCallback)
 {
     StartCoroutine(Restart(loader, true, shutdownCallback, restartCallback));
 }
示例#4
0
 internal void ShutdownLoader(OpenXRLoaderBase loader, Action shutdownCallback)
 {
     StartCoroutine(Restart(loader, false, shutdownCallback, () => {}));
 }