Forum Discussion

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

C# Scripts not executed using Oculus Integration

Hi there,

I am currently using Unity 4.5.5 free together with the Oculus SDK 0.4.3 Beta (for Win) and Unity 4 Integration (for Oculus SDK 0.4.3 Beta). The scene is visible on the rift, but no script is executed when I start the scene. The scripts where attached to GameObjects ath first but I attached the scripts to the OVRCameraRig->LeftEyeAnchor but that did not change anything. I am unsure to which Camera I should attach the scripts. If I don't use the rift all the scripts work properly.

Any suggestions what the problem might be?

7 Replies

Replies have been turned off for this discussion
  • drash's avatar
    drash
    Heroic Explorer
    What you're describing should work, but I suppose the devil is in the details. If you are still stuck on this, feel free to share the code of one of the scripts that should be working but isn't. I'm curious how you know the scripts aren't working?
  • @ drash, I could fix the execution problem. But one big problem remains:I am having an issue with using the Oculus Integration and creating GUIText. I am using a plane and a script to create a GUIText on the plane. For transfering it to the rift I am using the OVRPlayerController and I attached the Object with it's script to the OVRCamerRig. So I can see the plane in the scene. But I can't see the text rendered to the plane.I am using something simple like:


    public GameObject plane;
    void Start()
    {
    GUIText myText = plane.AddComponent<GUIText>();
    myText.guiText.text = "Hello";
    }


    Could it be that it is not possible to use GUIText with unity 4.5.5 and the rift extension? I am using a plane with a texture instead but that looks horrible.What would be the appropriate way to go about this?
  • drash's avatar
    drash
    Heroic Explorer
    For doing GUI stuff, you're going to want to shift gears and put everything into world space for VR. You can also look at the OVR/Scripts/Util/OVRGUI.cs's StereoBox() function to see how the OVRMainMenu is being rendered (pre-Unity 4.6).
  • @ drash. Thanks for the advice. I copy/pasted the Util/OVRGUI class, renamed it and ineherited from MonoBehavoiur. I called the Stereobox method from the Start() method I included but no rectangle is drawn.

    void Start()
    {
    StereoBox (0.5f,0.5f,0.5f,0.5f,"Test Oculus GUI",Color.black);
    }



    According to the SourceCode it should draw a rectangle. What am I missing here? Do I have to call another class to actually
    display it. Thanks a lot!
  • Is it an option for you to upgrade to Unity 4.6 and use the new uGUI system? That works much better in VR.
  • I upgraded to 4.6 but I have the issue that my panels freeze when I activate/deactivate them
  • Are you using coroutines to update your panel? If so, you need to re-start them after re-enabling the GameObjects that own them.