Skip to main content
Inspiring
June 16, 2015

Unity 5.1 and the Oculus Integration (Official Info)

Howdy,

A lot of changes are occurring with Unity VR development quickly, so we wanted to be sure to give you a clear heads up about what is happening, when it will happen, and what it means for developers.

= Unity First-Party Support =

Unity 5.1 introduced first-party support for virtual reality, making it easy to substitute a stereoscopic VR camera for your main camera by selecting the "Virtual Reality Supported" check box in Player Settings. The initial release of v 5.1 provides support for the Oculus Rift only.

On June 12, Unity released version 5.1.0p1, adding Gear VR support. All developers wishing to update to Unity v 5.1 should select this release, which is available for download here:
http://unity3d.com/unity/qa/patch-releases

For details on implementing Unity's first-party VR support, see the Unity manual: http://docs.unity3d.com/Manual/VROverview.html.

= Unity 5.1 and the Oculus Integration =

Unity 5.1 first-party VR support is incompatible with legacy versions of the Oculus Unity Integration (versions 0.6.0 and earlier). Projects using legacy versions of the Integration will only work with Unity v 5.1 if the "Virtual Reality Supported" box in Player Settings is not selected. In that case, they should work normally.

Oculus will be shipping an update to our Unity Integration shortly. If you import the new Oculus Integration version into a legacy VR project, it will work normally with Unity 5.1.

Once you update to this version, our Integration will work for the Rift and Gear VR if "Virtual Reality Support" is enabled.

= Known Issues =

Moving to Unity 5.1 is a substantial upgrade for VR development, and we recommend carefully choosing your timeframe for making the update. There is always risk in moving early to a new major release that you may encounter problems related to VR performance or otherwise.

Please let us know about any issues you encounter in the Oculus Unity forums, and keep your eye out for updates.

We are currently aware of the following issues with 5.1:

• All moonlight scripts, including platform UI, CPU/GPU levels, and overlay, are currently incompatible with 5.1.0. Updated versions will come with 0.6.0.1. The following features will no longer work:
• MediaSurface
• TimeWarp sub-stepping (only supports 60, no longer 20 or 30)
• Linear lighting (sRGB) and eye texture MSAA currently don't work. This will be fixed in Unity 5.1.0p2.
• VR.VRSettings.renderScale has no effect on Android.
• There is currently no way to render separate content (stereo video) to each eye. This may come back in a future Unity version.

For release notes and known issues in Unity 5.1:
https://unity3d.com/unity/whats-new/unity-5.1
    This topic has been closed for replies.

    108 replies

    Up and Coming
    July 15, 2015
    You mentioned that you weren't sure what the ETA of the integration of per eye rendering would be but would ask. I just wondered if you had any updates on this.
    Inspiring
    July 15, 2015
    No, I don't have an update yet but it seems like it's something that could be possible in the future.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    New Participant
    July 17, 2015
    "cybereality" wrote:
    Correct, the VR mode is detected when the game initializes. Though there is a setting to toggle this called VRSettings.enabled ( http://docs.unity3d.com/ScriptReference ... abled.html ) it doesn't really work like you would expect (but feel free to try it out). So, at this point, it's better to assume the player is has or does not have a Rift at startup and that's it.


    I had this problem where if I used OVR prefab in hierarchy, the screen would show VR and even move with the VR headset BUT nothing came through on my Oculus DK1.

    Do I need to create a "script" in this scene with "VRSettings.enabled" to get it to play in the Oculus?

    If so, can you give me the newb guide on how to do this. Im the graphic guy and I have to figure this out lol.

    Heres a screen shot of what im talking about.

    http://postimg.org/image/tepxzwyl3/full/

    When I do "Virtual Reality Support" it works on my Oculus, but I can't see the login screen and text of my game in the menu scene meaning all I can do is look around from main camera.
    Inspiring
    July 17, 2015
    Yes, all you need is "Virtual Reality Supported". In you can't see the menu, it probably means you are using an old GUI method (like OnGUI) that won't work in VR. Check the debug menu on the Utilities package to see how to handle a menu.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    New Participant
    July 17, 2015
    "cybereality" wrote:
    Yes, all you need is "Virtual Reality Supported". In you can't see the email, it probably means you are using an old GUI method (like OnGUI) that won't work in VR. Check the debug menu on the Utilities package to see how to handle a menu.


    I wish I knew exactly what that meant ! lol

    Here's the beginning on our Menu GUI script

    #pragma strict
    import System.Collections.Generic;
    import System.Xml;
    import System.IO;


    var mskin:GUISkin;
    var fileskin:GUISkin;
    var logotex:Texture;
    var fadetex:Texture;
    var loadtex:Texture;
    var tiletex:Texture;
    var ltexture:Texture;

    private var username:String ="";
    private var password:String="";
    var StatusMessage:String;
    var www:WWW;
    var mmode:int;
    var cols:int;
    var globescript:GlobalScript;
    var loadingscreen:boolean;
    var scrollPosition : Vector2 = Vector2.zero;

    //OFFLINE MODE VARS
    var filepath:String;
    var m_fileBrowser:FileBrowser;
    var m_textPath:String;
    var m_directoryImage:Texture2D;
    var m_fileImage:Texture2D;



    function Start()
    {
    if(GameObject.Find("VCObj"))
    {
    globescript = GameObject.Find("VCObj").GetComponent(GlobalScript);
    if(globescript.islogged==true)
    {
    mmode = 1;
    }
    } else {

    var gs:GameObject = new GameObject("VCObj");
    gs.AddComponent(GlobalScript);
    globescript = gs.GetComponent(GlobalScript);

    }

    }


    So im guessing this is the old method, what method do I need to do to change it? Again a graphics guy just trying to get this to work!
    Inspiring
    July 17, 2015
    I'm not sure what the code snippet is supposed to show. It doesn't seem to include the relevant code for the GUI.

    Anyhow, did you check out the debug menu included with the Oculus Utilities?
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    July 17, 2015
    Hello.

    I wanted to ask when are the issues I reported going to be solved, namely not providing correct _WorldSpaceCameraPos? They're breaking for my applications and while I can hack around it by modifying the shaders, it would be very tedious to modify all the shaders in the project! I have tried hacking around it by setting the global shader variable myself for each camera pass (Unity sends appropriate event just before the render and the matrix of the current camera contains its actual coordinates in the world space), but it seems to be reset to the position of the "non-VR" camera afterwards. If I set a differently named variable, then it works, but requires me to modify the shaders.

    I'm quite disappointed that you stopped providing the old style integration before these issues have been resolved, as now I'm forced to hack around the issues or use old integration that I have archived, but I'm now panicking, because neither solution seems to actually work :/ The old Unity integration doesn't turn the HMD on in Direct Mode with the newer SDK and the new Unity integration... well doesn't work without me hacking everything to work around the bugs.

    Please fix this as soon as possible.
    Up and Coming
    July 17, 2015
    When I use the native integration w/ 5.1.1p3, I get a constantly small amount of noise in the position and rotation of the camera. I verified by creating an empty project w/ a simple scene and sat the rift on my desk. Here's a screen-cap: https://www.dropbox.com/s/3i8l01qx9zp8gqz/oculus_unity5_jitter.mp4?dl=0

    Anyone else seeing this?
    New Participant
    July 17, 2015
    "cybereality" wrote:
    I'm not sure what the code snippet is supposed to show. It doesn't seem to include the relevant code for the GUI.

    Anyhow, did you check out the debug menu included with the Oculus Utilities?


    I checked console and I am getting this message.

    OVR Error:
    OVRTime: 177148.365207
    Time: 2015-07-17 16:10:18 [399:75:700]
    Code: -1003 -- ovrError_Timeout
    System error: -2005270527 (887a0001) -- The application made a call that is invalid. Either the parameters of the call or the state of some object was incorrect.
    Enable the D3D debug layer in order to see details via debug messages.

    Description: Fence ReleaseSync

    So do I need to create a canvas for my GUI to get it in the front layer and centered not rotating with VR headtracking?

    It kills me that its working as far as the VR support, but I can't get past the menu to play the game!
    Inspiring
    July 17, 2015
    "Frooxius" wrote:
    I wanted to ask when are the issues I reported going to be solved, namely not providing correct _WorldSpaceCameraPos?

    This should be fixed in a Unity patch release within the next week or two. If you are blocked by it, I would recommend sticking with the legacy Oculus integration.

    "Frooxius" wrote:
    I'm quite disappointed that you stopped providing the old style integration before these issues have been resolved

    We didn't. The Utilities are in beta and you are still free (and in this case encouraged) to use the legacy integration.