getting the oculus rift dk2 to work in unity 5(hmd mode)

So a few months back i bought an oculus rift dk2. I can get it to work fine with games and apps i download online, sometimes in direct to hmd mode, sometimes i have to duplicate the desktop, but it works i know that much. When i tried actually developing for it, I believe i was still using unity 4 back then, i remember going through all of this for hours and eventually giving up on getting it to work with unity.

now, i just got the leap motion mount and really want to start devloping for vr with it. I assumed with unity 5 the problems i have been having (see below) would be fixed, sadly, i am still getting the same results and cant find a real solution to my problem anywhere online. I remember reading somewhere that unity 5 uses direct x 11 and turning that off will fix it but that crashes unity every time and then turns it back on when i re-open the project. Anyway here is what happens when i try to use the oculus with unity.

  • if i choose direct to hmd mode, the light on the oculus is orange, the screen is black but the motion controls seem to be working (i can see the game view on my tv)
  • if i choose extend to desktop mode on my oculus and in screen resoulition i choose “show only on desktop one” smae thing, orange light, black oculus screen, but now the motion controls are not working on my tv
  • if i choose extend to desktop mode and in screen resolution choose “show only on desktop 2” then the oculus just shows everything that was on my monitor, but instead of getting that “vr look” (3d looking) everything in the game view is in two seperate 2D displays and the motion controls are still not working.
  • if i choose to duplicate these displays in the screen resolution, it shows whatws on my monitor, motion controls are not working, and now everything on my tv is sideways.
  • if i choose to extend these displays, the blue light on the oculus is on, the motion controls are working, but the screen is still black. (so far this is the closest ive gotten to it working)
  • while still in extend these displays, if i check “set this as my main display” for the oculus, the blue light is on, the motin controls work, my desktop is shown ONLY in the left eye and the game itself is still being shown on the monitor
  • while still in this mode and screwing around with the portrait and landscape settings between the two displays, i noticed that the left eye shows half of my desktop, the right eye is black but i can move the mouse over there (my background is black so it might just be that)
    im sure everybody who has an oculus rift has had this problem ive tried everything i can think of, this entire process is a huge pain in the ass. so…

Has anybody actually gotten the oculus rift dk2 to work with a unity 5 game they are working on (not an executable from the internet)?
If so How did you do it?
and do i have to use weird settings in “extend to desktop mode” or is there any way to get this working in “direct to hmd” mode?

I dont think this really matters but im running windows 8.1, unity 5, my monitor is a panasonic tv, quad core i7 processor, 16 gb of ram, 4095MB NVIDIA GeForce GTX 745 graphics card

So for anybody else having this problemi figured it out. First of all, use direct to hmd mode for the oculus. second, dont do anything for the screen resolution for your computer, leave it how it is. the oculus will not work in play mode for unity, you have to build the project. if you use the oculus assets, you will automatically have an executable called ProjectName_DirectToRift.exe. if you click on that the project should show up in the oculus. thats all there is to it, pretty simple.