cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

SDK 0.4.3 Unity free integration not working

TonyVT
Level 3
Hello to all! I'm an oculus developer using Unity.
Few days ago I read about the ability to use Oculus with unity free and I was very excited. So I downloaded today the new Oculus Rift SDK0.4.3, updated the firmware and the runtime. All compiled demos work very well.

After that, I tried to import the oculus-unity integration package inside a blank project and... everything went bad 😞 .
At present time, I'm using Unity free version 4.6.0b17 on Windows 8.1 . Oculus device is DK2.

This is what happens:
When I import the package, a compilation error occurs:
Assets/OVR/Editor/OVRShimLoader.cs(46,32): error CS0117: `UnityEditor.PlayerSettings' does not contain a definition for `d3d11ForceExclusiveMode'
Assets/OVR/Editor/OVRShimLoader.cs(47,32): error CS0117: `UnityEditor.PlayerSettings' does not contain a definition for `visibleInBackground'


So I've opened that file and commented those lines (they don't seem critical lines to me). After that, all compiled well.

So I opened Cubes Scenes, launched it and... an epic fail occurred.
I receive a ton of exceptions. The first is:
EntryPointNotFoundException: ovr_GetVersionString
Ovr.Hmd.GetVersionString () (at Assets/OVR/Scripts/OvrCapi.cs:1309)
OVRManager.Awake () (at Assets/OVR/Scripts/OVRManager.cs:318)

All the milion others are:
NullReferenceException: Object reference not set to an instance of an object
OVRCameraRig.ConfigureCamera (OVREye eye) (at Assets/OVR/Scripts/OVRCameraRig.cs:183)
OVRCameraRig.UpdateCameras () (at Assets/OVR/Scripts/OVRCameraRig.cs:112)
OVRCameraRig.Start () (at Assets/OVR/Scripts/OVRCameraRig.cs:77)

When I move the mouse I also get something like this:
Screen position out of view frustum (screen pos 593.000000, 247.000000) (Camera rect 0 0 811 271)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)


I really don't know what to do. I tried yet:
- rebooting the pc
- redownloading the package and importing it in a brand new project
- changing Oculus Display mode from extended to direct
- copying the OculusPlugin.dll in the Asset and Root folder of the project
- modifying the scripts to initialize the objects after a "tracker initialized" events
but with no luck.

Any ideas in how solving this issue? Am I missing something? Maybe Unity version 4.6 is not supported?
15 REPLIES 15

cwm3D
Level 2
"vrdaveb" wrote:
It sounds like you are using the Unity editor and not a standalone build. Is that correct? To make the editor render to the Rift, you need to switch to extended mode, drag the Game view to the Rift, and maximize it...

If you build a standalone player and run _DirectToRift.exe, it should appear on the Rift regardless of whether you use extended or direct display mode. Does that work for you?


Thx for your patience. Yes, I am referring to use of the Unity editor. Thx for clarification that it *MUST* be in extended mode, because the docs cover both options! It wasn't clear that extended mode is *required* for it's use. (Maybe that will change in the future?) A video demo of it's setup & use would be handy.

Also, I can successfully compile demos in Unity5beta and execute the DirectToRift compilations. πŸ™‚ I actually came here to post that followup. Thx & Best Wishes, Chris

TonyVT
Level 3
For all you guys out there... problem solved!
"DanB" wrote:
I believe Unity 4.5.5 is needed if you want Rift support in the free version. If you want to keep using 4.6 beta, then the beta version which is equivalent to 4.5.5 is 4.6 beta 21, which is bleeding edge and described as "Latest release with minimal testing, Has only been spot tested by Unity QA. No Web Player support."

This was the solution! Thanks a lot, DanB... I upgraded from 4.6 beta 17 to 4.6 beta 21... and suddenly all began to work! First time I got a strange information about a DK2 not supported device... so I closed Unity, reopened it and... bang! Unity free and Oculus Rift finally working together.

I even tried to build the project as standalone and everything is alright!

The only problem is that something is still buggy... when I start play mode the first time inside the Unity editor, the scene tab becomes black or freezes itself... I noticed that it doesn't refresh itself. To let it refresh during play mode, I had to move it somewhere else on the screen (and then eventually restoring the 2-by-3 layout). It is a nuisance... don't know why it happens, but it's better for the Unity/Oculus team to know that I've this issue.

Thanks a lot again!!!

vrdaveb
Oculus Staff
Glad it's working for you. We are working with Unity to fix the editor refresh issue. It may help to resize the view or start and stop play mode.

tpassow
Level 2
Could someone please post a clear description of the setup used to get the Oculus Rift working through Unity 4.6 free version with SDK 0.4.3? My export seems to be working for the most part, however I am not experiencing any of the rotation from the Oculus Rift. Only mouse and keyboard input. I was wondering if someone could post their setup. my current setup is using an empty Game Object with FPScontroller, MouseLook, Character Controller and Character Motor scripts with an OVRcamerarig as it's child.

vrdaveb
Oculus Staff
Have a look at section 3 of the integration guide: http://static.oculus.com/sdk-downloads/documents/OculusUnityIntegrationGuide_0.4.4.pdf. Basically,
1) Install the 0.4.3 runtime, which includes the display driver, camera drivers, and service.
2) Make sure the service is running by testing with the demo scene in the Oculus Configuration Utility. You can do this by plugging in your DK2 and camera, double-clicking the white Oculus icon in the system tray, and clicking "Show Demo Scene". If the scene renders and tracks fine there, your DK2 should also work with Unity.
3) Restart Unity and open your project and scene.
4) Remove the OVR folder and any Oculus or OVR-related files from the Plugins folder.
5) Import the 0.4.3 Oculus unitypackage.
6) If you have any plugins other than the Oculus plugin, make sure they are in the Plugins/x86 or Plugins/x86_64 folder (this is the new standard setup for Unity moving forward).
7) Drag the OVRCameraRig prefab into your scene.
😎 Add any custom image effects, scripts, or child GameObjects you need in the OVRCameraRig.
9) Build a standalone player
10) Open the folder where the player was saved
11) Run <AppName>_DirectToRift.exe.

Your tracking camera should light up and the game should render to your DK2.

tpassow
Level 2
thanks vrdaveb! I'll give your setup a try. I'm trying to get a PC up and running. I'll let you know.