Skip to main content
Up and Coming
November 28, 2014

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?
    This topic has been closed for replies.

    7 replies

    Inspiring
    November 29, 2014
    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?
    Titans of Space PLUS for Quest is now available on DrashVR.com
    gabrieadAuthor
    Up and Coming
    December 1, 2014
    @ 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?
    Inspiring
    December 1, 2014
    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).
    Titans of Space PLUS for Quest is now available on DrashVR.com
    gabrieadAuthor
    Up and Coming
    December 2, 2014
    @ 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!
    Inspiring
    December 5, 2014
    Is it an option for you to upgrade to Unity 4.6 and use the new uGUI system? That works much better in VR.
    gabrieadAuthor
    Up and Coming
    December 9, 2014
    I upgraded to 4.6 but I have the issue that my panels freeze when I activate/deactivate them
    Inspiring
    December 10, 2014
    Are you using coroutines to update your panel? If so, you need to re-start them after re-enabling the GameObjects that own them.