Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
HedgehogTeam's avatar
HedgehogTeam
Explorer
10 years ago

OVRManager.HMDUnmounted event seems to not work correctly

Hi,

I use OVRManager.HMDUnmounted to detect that the player removes the GEAR, to stop reading the video and bring up a menu.

But the operation remains strange, I have two scenes the main menu and the player. When the scene "player" is loaded for the first time the detection is never performed, I need to go back to main menu and reload the player scene. 

From the moment that the scene was load 2 times the event is correctly received, and the video stops as desired,  but all SetActive commande are not taken into account ...

Is there another method to detect the player removes the Gear VR ?

Here my code

void OnEnable(){
  OVRManager.HMDUnmounted += OVRManager_HMDUnmounted;
}

void OnDisable(){
  OVRManager.HMDUnmounted -= OVRManager_HMDUnmounted;
}

// Seems to be ok nly after the seond load of the scene
void OVRManager_HMDUnmounted (){
  mediaCtrl.Pause();                       // OK after the second load
  VRCameraUI.SetActive( true);     // Not take into account
  reticule.SetActive( true);                // Not take into account
  playerMenu.SetActive( true);        // Not take into account
}


Thank you

Nicolas

4 Replies

Replies have been turned off for this discussion
  • That's the right way to do it. What Unity version are you using?
  • I just wrote a very similar script and the HMDUnmounted event fired as expected. It won't fire if you're in developer mode. Can you make sure that isn't enabled?
  • Yes it isn't. 
    I will remove this functionality I've already spent too much time on this, but this may be related to video playback plugins that I use...

    Thank you