Skip to main content
Up and Coming
May 9, 2013

Step by step guide to Unity integration?

I am pretty new to Unity and the Oculus SDK did not tell me much. Are there someone who could make a step by step guide how to integrate the Oculus SDK to Unity? :)
    This topic has been closed for replies.

    25 replies

    Participant
    May 9, 2013
    Drag the OVR camera controller prefab onto your existing FPS player. Position it at the head. Link the part of your player that rotates to the OVR camera controller's script where it says something like 'follow orientation'.

    Congrats, you've made a game for the Rift!

    Okay, getting your menus to work and such is going to take a bit longer, but that's the basics and should have you playing around in no time.
    nypraiseAuthor
    Up and Coming
    May 9, 2013
    And that is in /LibOVR/Src/? What is the filename? Can´t seem to find a Camera controller there. :?
    Inspiring
    May 9, 2013
    1) Open Unity and create a new project and a new scene (or open the project you wish to add Rift support to).
    2) From the top menu, under "Assets" choose "Import Package" -> "Custom Package"
    3) Find the 'OculusUnityIntegration' folder you should have extracted from the 'ovr_unity_0.2.1_lib.zip' download file.
    4) Click on the 'OculusUnityIntegration.unitypackage' and click 'Open'.
    5) In the Project menu click the down arrows next to 'Assets' then 'OVR' then click "Prefabs'.
    6) In the window drag the 'OVRPlayerController' into the Scene view.
    7) If this is a new scene you may want to create a floor first and add some objects so you can see whats going on.
    8) Reposition the 'OVRPlayerController' into a good place in the scene, above the floor and not colliding with anything.
    9) Drag the 'Game' window onto the Rift screen (if in extended desktop mode) and click the small square next to the 'x' on the top-right.
    10) Click 'Play'.
    11) Have fun!
    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
    nypraiseAuthor
    Up and Coming
    May 10, 2013
    @cyberreality Now that´s a step by step guide! Thanks a million! :)
    Up and Coming
    May 16, 2013
    Is IPD a variable which value can be adjusted in the Unity OVRController?
    Up and Coming
    August 25, 2013
    Thank you cyber! now is there a way to be able to choose at the start if the game will have the oculus enabled or not?
    also, how can i get the skybox to be black, when i change the camera from blue to black, it automatically reverts it.
    Up and Coming
    August 25, 2013
    "Breymac" wrote:
    Thank you cyber! now is there a way to be able to choose at the start if the game will have the oculus enabled or not?
    also, how can i get the skybox to be black, when i change the camera from blue to black, it automatically reverts it.


    Try this: in the OVRCameraController script, add...

    [SerializeField]

    ...on a line by itself before the two lines that set the background color. (Search for "background" and you'll find the spot.)

    Otherwise, the color you set in the Unity GUI inspector keeps getting overridden. (Not sure if this is a bug or intentional.)

    The same is theoretically true of other settings, though I've had mixed results.
    — Morgan — Mac OS X ❆ Unity
    Up and Coming
    August 26, 2013
    Hm, didnt seem to work, got overwritten, but when i was mid-game and switched it, it stayed.
    New Participant
    August 26, 2013
    Followed the steps listed above, seems to work except the crosshair.

    I tried draggin and dropping the 'OVRCrosshair' script onto the OVRPlayerController and got the following error
    "Can't add script behaviour OVRCrosshair. The script needs to derive from MonoBehaviour!"

    So I edited the script and changed
    public class OVRCrosshair

    to

    public class OVRCrosshair : MonoBehaviour


    Now I am able to drag and drop to the Player Controller, then updated the null objects with the prefabs in my current scene, but nothing shown.

    Question: How do I make the crosshair to show/work?
    Inspiring
    August 28, 2013
    You can press "C" to make the crosshair appear. You don't have to edit the scripts.
    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