[DesktopVRSwitch] Wait frame on MovementSystem OnPostSwitch.

testing
This commit is contained in:
NotAKidoS 2023-06-20 06:05:51 -05:00
parent 0fb7c3d401
commit 52d4ef3279
8 changed files with 123 additions and 48 deletions

View file

@ -0,0 +1,39 @@
using System.Collections;
using UnityEngine;
namespace NAK.DesktopVRSwitch;
class VRModeSwitchDebugger : MonoBehaviour
{
private Coroutine _switchCoroutine;
private WaitForSeconds _sleep = new WaitForSeconds(2.5f);
private void OnEnable()
{
if (_switchCoroutine == null)
_switchCoroutine = StartCoroutine(SwitchLoop());
}
private void OnDisable()
{
if (_switchCoroutine != null)
{
StopCoroutine(_switchCoroutine);
_switchCoroutine = null;
}
}
private IEnumerator SwitchLoop()
{
while (true)
{
if (!VRModeSwitchManager.Instance.SwitchInProgress)
{
VRModeSwitchManager.Instance.AttemptSwitch();
yield return _sleep;
}
yield return null;
}
}
}