Correct way to pause game when headset removed / Dash up?
Hi! I am working on a VR application and I need to meet VR.PC.Functional.3. I am testing this in a simple Menu Scene I designed, and it only works partially. When I hit the Oculus button to return to the Dash, the app pauses. Hitting that button again returns the game correctly. However, upon removal of the headset and putting it back on, the OVRCameraRig never begins rendering again. I looked at the component in the inspector while this problem is occurring, and it appears the the OVRCameraRig never was SetActive(true) again. Can anyone help or give me their code that works?
Thanks in advance,
PicoPlanet Developing
Below is my pause script, attached to a separate gameobject:
Any help / code would be greatly appreciated!
Thanks in advance,
PicoPlanet Developing
Below is my pause script, attached to a separate gameobject:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MenuPauseControl : MonoBehaviour
{
public GameObject OVRCameraRig;
public GameObject Canvas;
public GameObject EventSystem;
void Start()
{
}
void Update()
{
if (OVRManager.hasInputFocus && OVRManager.hasVrFocus)
{
ContinueGame();
}
else
{
PauseGame();
}
}
private void PauseGame()
{
Time.timeScale = 0;
//Disable stuff that still work while timescale is set to 0
OVRCameraRig.SetActive(false);
Canvas.SetActive(false);
EventSystem.SetActive(false);
}
private void ContinueGame()
{
Time.timeScale = 1;
//enable the stuff again
OVRCameraRig.SetActive(true);
Canvas.SetActive(true);
EventSystem.SetActive(true);
}
}and here's my hierarchy:Any help / code would be greatly appreciated!
