Skip to main content
Participant
July 15, 2016
Solved

The Mysterious Volume UI

  • July 15, 2016
  • 32 replies
  • 12989 views
I'm trying to get my Unity app ready for submission. I'm using Unity version 5.3.5p5 and Oculus Utilities for Unity 5 V1.5.0. I've gotten the needed back button functionality working, but for the life of me I can't figure out the required volume UI. In the utilities, there's a VolumeController prefab under Moonlight that's missing a script, though I thought I've read other things are supposed to be supplying the Volume UI (OVRManager?). Nothing has worked so far. I even tried the Oculus Sample Framework for Unity 5 Project Oculus provides, but that doesn't have the volume UI working in it either. So I don't even have a working version to work back from.

Does anyone have any idea how to get the Volume UI working in 1.5.0? All the help online I've been able to find seems to refer to earlier version of the Oculus utilities and scripts that no longer exist.
    This topic has been closed for replies.
    Best answer by ProfessorTroy
    Alright!

    So the newest Unity package is missing the OVRVolumeControl.

    Here is a version that "works" with the current package. It won't show the volume bar if you're already at max/min values, because the event that the button was hit appears to be missing so you can't key off it here.

    I added the LastVolumeInput, TempVolumeInput and TimeToCheck values so it tracks when the volume has changed. There was some minor changes made to the Update function as well.

    Add this behavior to the prefab with the missing script.
    Add that prefab to your camera.
    Position it where you want it to appear in the users vision.
    Blamo - it'll work.


    Cheers!

    using UnityEngine;
    using System.Collections;

    public class OVRVolumeControl : MonoBehaviour
    {
        private const float         showPopupTime = 3;
        private const float            popupOffsetY = 64.0f / 500.0f;
        private const float            popupDepth = 1.8f;
        private const int             maxVolume = 15;
        private const int             numVolumeImages = maxVolume + 1;
        
        private Transform            myTransform = null;

        private float LastVolumeInput;
        private float TempVolumeInput;
        private float TimeToCheck = 0.0f;
        
        void Start()
        {
            DontDestroyOnLoad( gameObject );
            myTransform = transform;
            GetComponent<Renderer>().enabled = false;
            LastVolumeInput = OVRManager.volumeLevel;
        }

        void Update()
        {
            UpdatePosition(Camera.main.transform);
        }

        /// <summary>
        /// Updates the position of the volume popup. 
        /// </summary>
        public void UpdatePosition(Transform cameraTransform)
        {
            // OVRManager.volumeLevel returns a negative value in GearVR/Unity until the button is hit at least once.
            
            float check = OVRManager.volumeLevel;
            if ((check < 0f) || (check == LastVolumeInput))  // we haven't gotten a volume button check yet.
            {
                TimeToCheck = 0f;
            }
            else
            {
                LastVolumeInput = -10; // there was a change, let this play out.
                if (TempVolumeInput != check)
                    TimeToCheck = 0.0f;

                TempVolumeInput = check;
                // Volume has changed...
                TimeToCheck += Time.deltaTime;

                if ((TimeToCheck < showPopupTime)) // for the next three seconds ....
                {
                    GetComponent<Renderer>().enabled = true;
                    GetComponent<Renderer>().material.mainTextureOffset = new Vector2(0.0f, (float)(maxVolume - (OVRManager.volumeLevel*maxVolume) ) / (float)numVolumeImages);
                    if (myTransform != null && cameraTransform != null)
                    {
                        // place in front of camera
                        myTransform.rotation = cameraTransform.rotation;
                        myTransform.position = cameraTransform.position + (myTransform.forward * popupDepth) + (myTransform.up * popupOffsetY);
                    }
                }
                else
                {
                    // 3 seconds have passed...
                    TimeToCheck = 0.0f;
                    LastVolumeInput = check;
                    GetComponent<Renderer>().enabled = false;
                }
            }
        }
    }

    32 replies

    Inspiring
    July 20, 2016
    I haven't even had a chance to re-submit to see if my custom solution is acceptable. Really don't like the idea of downgrading to Unity 1.4 package either.
    Inspiring
    July 20, 2016
    > my screen started jittering when I would look around, all smoothness ceased, and the game is virtually unplayable.  The same thing happened when I tried 5.3.5p8.

    It sounds like there may be some error or log spam occurring. Can you share the output of adb logcat?
    Participant
    July 21, 2016
    Logcat attached.  Not sure if it makes a difference, but this was captured while I ran the game in GearVR debug mode without the actual headset.
    Participant
    July 21, 2016
    @VicariousAlex  
    Just downloaded 5.3.6f1 and had the same issue.  Volume worked, but jittery and unplayable.  

    Inspiring
    July 21, 2016
    That logcat isn't complete. Can you rerun the app normally, using the headset, then take it out, plug in USB, and run "adb logcat > hereitis.txt" and send that?
    Participant
    July 22, 2016
    Hopefully this is what you are looking for...haven't had occasion to run logcats often.  The "retryUnity" file was limited to Unity operations.  
    Inspiring
    August 6, 2016
    Ok Fulby said:
    I don't know if you need that one for Unity, I think that SDK is for native Android development. If that's correct then you only need https://developer.oculus.com/downloads/game-engines/1.5.0/Oculus_Utilities_for_Unity_5/

    Ok, let me put all the things in detail.

    My Oculus project is doing fine except two minor problems.

    1. A back button long-press (greater than 0.75 seconds) must bring the user to the Universal Menu. A “back” short press action is interpreted by the application dependent on its current state, but generally it will retreat one level in an interface hierarchy. The short-press currently does not pause the menu on tap. A series of short press action within the app experience should ultimately bring up to the Return to Oculus Home menu for a user. 

    2. Your volume buttons must adjust the volume using the VR volume UI provided by the Oculus Mobile SDK. Currently, your volume display does not function as expected.

    My Process to solve this issues as follow.

    1. I created an empty gameobject and attached  OVRplatformmenu.cs and OVRmanager.cs, Here I choose 'Escape' button (which is the back button of Gear VR) in order to quit the game play and take me to Oculus Global menu on long press .


    2.Now I have setup the OVRvolumecontrol prefab and also attached the script, And make that a children to main camera. which shows the Volume UI perfectlly in scene mode, But in runtime/Testing that not visible at all! 

    Both of these solutions NOT WORKING at all. 
    I  had used and tested in separate projects with below plugins. 

    ovr_unity_utilities_1.3.0
    ovr_unity_utilities_1.3.2
    ovr_unity_utilities_1.5.0
    ovr_unity_utilities_1.6.0

    OVRPlugin_Unity5_1.3.0
    OVRPlugin_Unity5_1.3.2

    ovr_sdk_mobile_1.0.3

    So If anyone knows the solutions and help my project to re-submission I would deeply appriciate your help and I think so as the community.

    Thanks in advance.

    ffleming said:


    I'm trying to get my Unity app ready for submission. I'm using Unity version 5.3.5p5 and Oculus Utilities for Unity 5 V1.5.0. I've gotten the needed back button functionality working, but for the life of me I can't figure out the required volume UI. In the utilities, there's a VolumeController prefab under Moonlight that's missing a script, though I thought I've read other things are supposed to be supplying the Volume UI (OVRManager?). Nothing has worked so far. I even tried the Oculus Sample Framework for Unity 5 Project Oculus provides, but that doesn't have the volume UI working in it either. So I don't even have a working version to work back from.

    Does anyone have any idea how to get the Volume UI working in 1.5.0? All the help online I've been able to find seems to refer to earlier version of the Oculus utilities and scripts that no longer exist.


    Hi  I amusing unity 5.3.5f1, Would you please provide me a guidance about the Back button issue. I have the same problem with 'back button' and 'Volume UI'. Highly appreciate your help.




    Inspiring
    August 6, 2016
    If you can, try updating to 5.3.5p6 (or later) or go right to the latest patch version of 5.3.6. The volume UI is built into Unity at that point and you won't have to add the prefab to your project. Otherwise, you need to use an older version of the Oculus Unity tools to get the working prefab -though I'm not sure the correct version of the tools to use for that version of Unity. Probably 1.3 or 1.4.
    Inspiring
    August 6, 2016
    @plysaght47, thanks for the logs. I don't see an obvious reason the judder you're seeing, but it's definitely happening -- the game spends most of its time rendering at 30fps and there are ~5ms delays every frame or two. At this point you should probably use systrace or Unity's built-in CPU profiler to see where the app is spending its time.

    > I'm not sure the correct version of the tools to use for that version of Unity. Probably 1.3 or 1.4.

    Utilities 1.4 still contains OVRVolumeControl and should work with Unity 5.3.5p5 or earlier.

    > 
    A back button long-press (greater than 0.75 seconds) must bring the user to the Universal Menu. A “back” short press action is interpreted by the application dependent on its current state, but generally it will retreat one level in an interface hierarchy.

    Adding an OVRManager instance to your scene should fix this. Have a look at how it's done in the PlatformMenu sample of our Sample Framework.

    > 
    Your volume buttons must adjust the volume using the VR volume UI provided by the Oculus Mobile SDK.

    If you have the option of using Unity 5.3.5p6 or newer like @delphinius81 said, I would recommend that.
    New Participant
    August 10, 2016
    @plysaght47 
    Same issue here. The volume control UI is missing in Unity 5.3.5 using Oculus Utilities 1.5.0. If we upgrade to Unity 5.3.5p6 (or later), our game starts jittering and is unusable. We are now unable to submit the app since either the volume control is missing or the app is jittering...
    @vrdaveb There are no Oculus Utilities 1.4 for Unity. There exist only version 1.3.x, 1.5.x and 1.6.x
    So still no solution to this problem? Very frustrating...