3

I'm stuck on the last test for my app before submission to the Oculus store. I've tried all sorts with no avail. I need to do is pass the frames when not visible test.

Effectively, the app needs to go into pause mode when the user clicks the menu button on the oculus touch controller.

I need to stop all frames submitting from Unity. For example, things I've tried, turn off cameras, audio, ovrplayercontroller etc but frames being submitted when the menu button is pressed on the rift so it would appear to freeze the application.

I've tried disabling cameras in a foreach loop, disabling the player gameobject, ovr controllers all sorts.

I have a gameobject with a script attached to try and detect when the test will fire based on the HMD losing tracking.

Here's where I'm currently at (gone back to the basics again), any help would be greatly appreciated.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;

 public class HMDCheck : MonoBehaviour
 {

 public GameObject OVRCameraRig;

 private void Update()
{
    if (!OVRManager.isHmdPresent)
    {
        OVRCameraRig.SetActive(false);
         Time.timeScale = 0f;
     }
    else
    {
        OVRCameraRig.SetActive(true);
        Time.timeScale = 1f;
    }
 }

 }

Additionally their docs say the test performs this action:

TestSubmitFramesWhenNotVisible

Tests if your app stops submitting frames when the Universal Menu is open.

Note :

My most recent command line response for the test is the following output :

Starting TestSubmitFramesWhenNotVisible Waiting for the application to run for 5 seconds before testing begins...

Starting test...

Requesting the void...

Number of texture swap chains committed when visible 68

Number of texture swap chains committed when not visible 4

ERROR: Committed a texture swap chain (called ovr_CommitTextureSwapChain) when application not visible

Please refer to VRC Guidelines: https://developer.oculus.com/distribute/latest/concepts/vrc-pc-input-1/

Cleaning up... Test FAILED

Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62
Diego
  • 371
  • 1
  • 3
  • 13

3 Answers3

1

To get around it, I created a script with public gameobjects. I then dragged my player into the slots inside Unity but left the camera on the scene alone. Here's a screenshot and the code. I initially added the camera to turn off frames sending but Oculus rejected it as it froze in the background upon pressing the menu button.

enter image description here

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HMDCheck : MonoBehaviour
{

public GameObject target, scripts, LocalAvatar;

private void Update()
{
    if (!OVRManager.hasVrFocus || !OVRManager.isHmdPresent || !OVRManager.hasInputFocus)
    {
        //target.SetActive(false);
        scripts.SetActive(false);
        LocalAvatar.SetActive(false);
        Time.timeScale = 0f;
        AudioListener.pause = true;
    }
    else
    {
        //target.SetActive(true);
        scripts.SetActive(true);
        LocalAvatar.SetActive(true);
        Time.timeScale = 1f;
        AudioListener.pause = false;
     }
 }

 }
Diego
  • 371
  • 1
  • 3
  • 13
0

I have almost the same code, but this detects the Universal Menu correctly and does freeze the output, but it still won't pass the test. I think it may pass if you disable splash screens, but can't know since I have the free version of Unity.

Edit: I saw your answer Diego, but cannot comment. Did your action resolve your original question? And what license do you have for Unity?

Camera cam;
bool bPause = false;
void Update()
{
    //install 'Oculus Integration' for this to work
    bool bPauseNow = !(OVRManager.hasInputFocus && OVRManager.hasVrFocus);

    //pause state change
    if (Camera.main != null) cam = Camera.main;
    if (bPause != bPauseNow)
    {
        bPause = bPauseNow;
        if (bPauseNow)
        {
            Time.timeScale = 0.0f; //stops FixedUpdate

            //Update keeps running, but 
            // rendering must also be paused to pass vrc
            cam.enabled = false;
        }
        else
        {
            Time.timeScale = 1.0f;

            //
            cam.enabled = true;
        }
    }

    //...
}
Ronnie
  • 116
  • 8
0

I am using the "Oculus XR Plugin", and got this issue, but I found that the results of the "VRC Validator" are not so accurate, then I submitted the App for review and passed the test.

Led Machine
  • 7,122
  • 3
  • 47
  • 49