Forum Discussion

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

Can't get Unity5 to build with Oculus integration

Trying a simple VR test using Unity. I have imported the Oculus Unity 4.4 integration into my Unity5 beta project. When I try and build I get this error;

"Assets/OVR/Scripts/UtilOVRUGUI.cs(92,24) : warning CS0414 : The PRIVATE FIELD 'OVRUGUI.numOfGUI' is assigned but its value is never used'

I am new to Unity and don't deal with C++ etc, am coming in as an artist so would appreciate any guidance on how I can fix this? All I have is a plane, point light and cube in my scene.

6 Replies

Replies have been turned off for this discussion
  • mdk's avatar
    mdk
    Honored Guest
    remove the OVRMainMenu script and it should work. It's not ideal, but at least I got it to work that way.
  • You guys have the latest U5 beta? Sounds strange that it wont find that namespace.
  • So i tried the latest U5 beta
    worked after i deleted the OVRMainMenu script
    but im finding judder, even on simple scenes.
    anyone got it running smooth?
  • capwn's avatar
    capwn
    Honored Guest
    Ah, working! Thanks everyone!

    So I deleted OVRMainMenu.cs, was still crashing, so I then deleted OVRUGUI.cs which was also coming up in my errors and it built. I'm just now wondering if deleting such files will cause problems later?

    It ran really smoothly too, basedeltazero I'm wondering if you're in direct mode and that's why it isn't smooth? I found out yesterday that Unity Oculus should always be in extended.

    Next step is to figure out how to get the game to display FPS and see if there are any tricks to increase it. In Unreal4 there were commands that you could automatically execute at the start of the game. Stereo this, hmd that etc. I'll have a dig later but if anyone knows any good resources/tutorials for this kind of thing it would be much appreciated.
  • Easy!
    Just use this script on a GUI Text component (4.6 UI).

    using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;

    public class ShowFPS : MonoBehaviour
    {
    public float updateInterval = 0.5F;

    private float accum = 0; // FPS accumulated over the interval
    private int frames = 0; // Frames drawn over the interval
    private float timeleft; // Left time for current interval
    private Text myText;

    void Start ()
    {
    myText = GetComponent<Text>();
    timeleft = updateInterval;
    }

    void Update ()
    {
    timeleft -= Time.deltaTime;
    accum += Time.timeScale/Time.deltaTime;
    ++frames;

    // Interval ended - update GUI text and start new interval
    if( timeleft <= 0.0 )
    {
    // display two fractional digits (f2 format)
    float fps = accum/frames;
    string format = ((int)(fps)).ToString() + "fps";
    myText.text = format;

    if(fps < 30)
    myText.color = Color.yellow;
    else if(fps < 10)
    myText.color = Color.red;
    else
    myText.color = Color.green;

    timeleft = updateInterval;
    accum = 0.0F;
    frames = 0;
    }
    }
    }


    Edit: Credit goes to the one that posted this on the Unity wiki, i just modified it to work with the new UI.