// Updates the position of the volume popup // Should be called by the current camera controller in LateUpdate public virtual void UpdatePosition(Quaternion cameraRot, Vector3 cameraPosition) { // OVRDevice.GetTimeSinceLastVolumeChange() will return -1 if the volume listener hasn't initialized yet, // which sometimes takes place after a frame has run in Unity. double timeSinceLastVolumeChange = OVRDevice.GetTimeSinceLastVolumeChange(); if ((timeSinceLastVolumeChange != -1) && (timeSinceLastVolumeChange < ShowPopupTime)) { renderer.enabled = true; renderer.material.mainTextureOffset = new Vector2(0, ( float )(MaxVolume - OVRDevice.GetVolume()) / ( float )NumVolumeImages); if (MyTransform != null) { // place in front of camera MyTransform.rotation = cameraRot; MyTransform.position = cameraPosition + (MyTransform.forward * PopupDepth) + (MyTransform.up * PopupOffsetY); } } else { renderer.enabled = false; } }