branch
parent
37d0e6e64a
commit
78b3fffa8b
@ -1,44 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.XR.Management;
|
|
||||||
|
|
||||||
public class XRControl : MonoBehaviour
|
|
||||||
{
|
|
||||||
private XRManagerSettings xrManager;
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
xrManager = XRGeneralSettings.Instance.Manager;
|
|
||||||
if (XRGeneralSettings.Instance.Manager.activeLoader == null) { StopXR(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartXR()
|
|
||||||
{
|
|
||||||
StartCoroutine(StartXRLoader());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StopXR()
|
|
||||||
{
|
|
||||||
StartCoroutine(StopXRLoader());
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator StartXRLoader()
|
|
||||||
{
|
|
||||||
if (!xrManager.isInitializationComplete)
|
|
||||||
{
|
|
||||||
xrManager.InitializeLoader();
|
|
||||||
yield return new WaitUntil(() => xrManager.isInitializationComplete);
|
|
||||||
xrManager.StartSubsystems();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator StopXRLoader()
|
|
||||||
{
|
|
||||||
if (xrManager.isInitializationComplete)
|
|
||||||
{
|
|
||||||
xrManager.StopSubsystems();
|
|
||||||
xrManager.DeinitializeLoader();
|
|
||||||
yield return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 769b401939dd60141b0d748e39469b2a
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Loading…
Reference in New Issue