Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
AndyOHart's avatar
AndyOHart
Honored Guest
11 years ago

Urgent help needed please

Hey. So I have ran into a problem and I have a presentation tomorrow for my game. Basically the game has stopped working and I have no idea why. It worked fine, then I started working on a main menu for the game. I'm using the Oculus Rift and Razer Hydras and basically I have ran into an issue where when I start the game, it just says to Attach the Rift and Hydras to play.
Here is the update method:

void Update(){
Debug.Log("Here");

//If the hydras are placed on base station, recalibrate
if(SixenseInput.Controllers[0].Docked && SixenseInput.Controllers[1].Docked && hasCalibrated){
Destroy(GameData);
hasCalibrated = false;
Start();
}

SixenseInput.Controller leftHydra = SixenseInput.GetController(SixenseHands.LEFT);
SixenseInput.Controller rightHydra = SixenseInput.GetController(SixenseHands.RIGHT);

if(leftHydra == null || rightHydra == null)
return;

if(SixenseInput.Controllers[0].GetButtonUp(SixenseButtons.START))
OVRDevice.ResetOrientation(0);

//Run through each state for calibration
switch(gameSetupData.State){

//If its disabled, enable it
case GameSetupData.CameraState.Disabled:
if(SixenseInput.IsBaseConnected(0) && OVRDevice.SensorCount > 0){
Debug.Log("Here2");
gameSetupData.enabled = true;
gameSetupData.State = GameSetupData.CameraState.CalibrateFloorDistance;
}
break;


The problem here is that the first debug line, "Here", runs, however it never enters the first state where the debug line "Here2" is, I never see that line. I have no idea why it isn't entering that switch?
This leads me to seeing this bit of info on screen from the OnGUI method:
void OnGUI(){

    switch(gameSetupData.State){
case GameSetupData.CameraState.Disabled:
GUI.Box(new Rect(Screen.width/2 - 200, Screen.height/2,400,30),"Attach Rift & Hydra to play");
break;


Can anybody see why this would of stopped working? All I did was make a new scene called MainMenu, and make it so looking at text loaded a new scene. The Oculus component I use in the main menu is different to the one in the loaded levels (The loaded levels use the Hydra as well for calibration at the start however the main menu uses a stationary Oculus Controller)
Any ideas?

2 Replies

  • drash's avatar
    drash
    Heroic Explorer
    Just based on the logic shown, I am guessing either the leftHydra or rightHydra are null, or SixenseInput.IsBaseConnected(0) is false. All three would probably happen if your Hydra isn't plugged in / recognized by Unity. Perhaps a restart of Unity, re-plugging-in the Hydra before firing up Unity, etc?

    Another observation is, I see you're calling Start() directly. I don't know what's in your Start() but it would be good to look at any state changes there, and also remember that Start() will always be called (once) before Update() if it's defined.

    Also, when you check OVRDevice.SensorCount > 0, maybe you could replace/augment this with the more appropriate OVRDevice.IsInitialized()?

    Good luck!
  • Can you remove the second Oculus component from the other scene and see if that helps at all?