Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do I disable the Volume Display?

Discussion in 'AR/VR (XR) Discussion' started by gibbie_learnersedge, Sep 15, 2016.

  1. gibbie_learnersedge

    gibbie_learnersedge

    Joined:
    Aug 11, 2016
    Posts:
    25
    Hi Guys,

    I recently submitted my app to oculus store and the rejected it.
    One of their reason is "Your volume buttons must adjust the volume using the VR volume UI provided by the Oculus Mobile SDK. ".


    For some reason, if I were to increase of decrease volume. When this UI appear, it will freeze the GearVR screen.

    I couldn't find any code in Unity Documentation though, or I missed it somewhere.
    Any way to disable the Volume UI of Android or to solve this issue?

    Regards,
    Gibbie
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    You have to override the onKeyDown and onKeyLongPress handlers in the Activity.
     
  3. gibbie_learnersedge

    gibbie_learnersedge

    Joined:
    Aug 11, 2016
    Posts:
    25
    Hi Jeo joe could you please provide me with a code example.
     
  4. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
  5. gibbie_learnersedge

    gibbie_learnersedge

    Joined:
    Aug 11, 2016
    Posts:
    25
    Hmm I am not sure if I would like to override them though. As if i were to override them I will not be able to decrease/increase volume. Would like to disable the "Android Volume Display" As in VR if were to adjust volume, it will freeze the screen when "Android Volume Display" appears. That's why I have an in-game volume display. Just need to disable the "Android Volume Display".
     
  6. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    I can't really help you there other than to tell you to override the keys, do your own volume handling and return true from the handler. Other than that I know of no way to just make the system volume ui go away.
     
  7. Martinez-Vargas

    Martinez-Vargas

    Joined:
    Jun 24, 2016
    Posts:
    39
    Hello , you have to check the script called " OVRVolumeControl " , the code must be equal to the following

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class OVRVolumeControl : MonoBehaviour
    5. {
    6.     private const float         showPopupTime = 3;
    7.     private const float            popupOffsetY = 64.0f / 500.0f;
    8.     private const float            popupDepth = 1.8f;
    9.     private const int             maxVolume = 15;
    10.     private const int             numVolumeImages = maxVolume + 1;
    11.    
    12.     private Transform            myTransform = null;
    13.    
    14.     void Start()
    15.     {
    16.         DontDestroyOnLoad( gameObject );
    17.         myTransform = transform;
    18.         GetComponent<Renderer>().enabled = false;
    19.        
    20.     }
    21.    
    22.     /// <summary>
    23.     /// Updates the position of the volume popup.
    24.     /// </summary>
    25.     public virtual void UpdatePosition(Transform cameraTransform)
    26.     {
    27.         // OVRDevice.GetTimeSinceLastVolumeChange() will return -1 if the volume listener hasn't initialized yet,
    28.         // which sometimes takes place after a frame has run in Unity.
    29.         double timeSinceLastVolumeChange = OVRManager.timeSinceLastVolumeChange;
    30.         if ((timeSinceLastVolumeChange != -1) && (timeSinceLastVolumeChange < showPopupTime))
    31.         {
    32.             GetComponent<Renderer>().enabled = true;
    33.             GetComponent<Renderer>().material.mainTextureOffset = new Vector2(0.0f, (float)(maxVolume - OVRManager.volumeLevel) / (float)numVolumeImages);
    34.             if (myTransform != null && cameraTransform != null)
    35.             {
    36.                 // place in front of camera
    37.                 myTransform.rotation = cameraTransform.rotation;
    38.                 myTransform.position = cameraTransform.position + (myTransform.forward * popupDepth) + (myTransform.up * popupOffsetY);
    39.             }
    40.         }
    41.         else
    42.         {
    43.             GetComponent<Renderer>().enabled = false;
    44.         }
    45.     }
    46. }
     
  8. gibbie_learnersedge

    gibbie_learnersedge

    Joined:
    Aug 11, 2016
    Posts:
    25
    I am using Oculus Utilities 1.8.0 I couldn't find OVRVolumeControl.