• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jun 23, 2017 at 10:01 AM by hexagonius for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by taranasus · Mar 25, 2016 at 05:52 PM · oculusoculusrift

Oculus not starting in Build mode but works fine in Edit/Play mode

So i've had this problem in both unity 5.3.2 and 5.3.4 now, it was working a while back but when I tested it today it no longer works and I have no idea why.

I have my oculus turned un and the config util runninng in the background. I try the oculus demo scene... works. Try my game in the editor, works just fine. Compile and build my game, turn it on, does not start in oculus mode. Ever!

Checked out the logs and there are no errors. It even says

[VRDevice] Successfully created device stereo.

I've even tried implementing my own code to turn it on

  if(VRDevice.isPresent==true)
         {
             Debug.Log("A VR DEVICE HAS BEEN DETECTED FFS!");
             VRSettings.enabled = true;
             VRSettings.showDeviceView = true;
         }   

It prints out that message in the log, no errors thrown, but the game still doesn't start in oculus mode.

Any ideas, suggestions?

Thanks for your time.

EDIT: To provide a little update on this. I've made the following code:

 if (VRDevice.isPresent == true)
                 {
                     Debug.Log("BEFORE SETTING: "+VRDevice.family + " - " + VRDevice.model);
                     VRSettings.loadedDevice = VRDeviceType.Oculus;
                     Debug.Log("AFTER SETTING: "+VRDevice.family + " - " + VRDevice.model);
                     Debug.Log("A VR DEVICE HAS BEEN DETECTED FFS!");
                     VRSettings.enabled = true;
                     Debug.Log("VRSETTINGS shows as: " + VRSettings.enabled);
                     VRSettings.showDeviceView = true;
                     Debug.Log("VRSETTINGS showdeviceview: " + VRSettings.enabled);
                 }

This is what i get in the editor:

A VR DEVICE HAS BEEN DETECTED FFS! UnityEngine.Debug:Log(Object) splashScreenAnimation:Start() (at Assets/scripts/splashscreen/splashScreenAnimation.cs:52)

BEFORE SETTING: oculus - Oculus Rift DK2 UnityEngine.Debug:Log(Object) splashScreenAnimation:Update() (at Assets/scripts/splashscreen/splashScreenAnimation.cs:80)

AFTER SETTING: oculus - Oculus Rift DK2 UnityEngine.Debug:Log(Object) splashScreenAnimation:Update() (at Assets/scripts/splashscreen/splashScreenAnimation.cs:82)

A VR DEVICE HAS BEEN DETECTED FFS! UnityEngine.Debug:Log(Object) splashScreenAnimation:Update() (at Assets/scripts/splashscreen/splashScreenAnimation.cs:83)

VRSETTINGS shows as: True UnityEngine.Debug:Log(Object) splashScreenAnimation:Update() (at Assets/scripts/splashscreen/splashScreenAnimation.cs:85)

VRSETTINGS showdeviceview: True UnityEngine.Debug:Log(Object) splashScreenAnimation:Update() (at Assets/scripts/splashscreen/splashScreenAnimation.cs:87)

That's awesome, that's what I expect! Nothing wrong :) Now for the compiled game:

[VRDevice] Successfully created device stereo. A VR DEVICE HAS BEEN DETECTED FFS! (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Setting up 1 worker threads for Enlighten. Thread -> id: 3758 -> priority: 1 BEFORE SETTING: stereo - (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

AFTER SETTING: stereo - (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

A VR DEVICE HAS BEEN DETECTED FFS!
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

VRSETTINGS shows as: False
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

VRSETTINGS showdeviceview: False
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Soooo something's wrong with the compiled game not detecting my oculus properly. But I'm not sure really what to do from here :/

EDIT 2: Okay bodged together a solution!

It seems that for some reason, my built code of unity is unable to detect what VR headset I have connected, but it can detect one is connected, returning a result of empty string for the headset model. Thus i've implemented the following code:

  if(VRDevice.isPresent==true && string.IsNullOrEmpty(VRDevice.model))
         {
             Debug.Log("EMPTY VR DEVICE DETECTED!");
             VRSettings.loadedDevice = VRDeviceType.Oculus;
             VRSettings.enabled = true;
             VRSettings.showDeviceView = true;            
         }   

Which works fine for now. I'm pretty sure the problem is isolated to just my PC since it was working before without a problem so this shouldn't affect too many people.

In the future I will want to add steam VR support so what i'm going to do is change the code above to just display a message of "VR Headset not Recognized" and then have a command line parameter to force on different types of VR headsets.

So for now, I guess I answered my own question... But if anyone figures out why this is happening, please let me and everyone else know.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by taranasus · Mar 25, 2016 at 11:46 AM

So a bit of progress and a behavior update. After playing with it a bit, turning on and off etc, now the results are a bit different. Something seems to be locking up my oculus and not letting go once i exit the application.

Here's the new behavior:

I run the built game, all of a suddeon it magically works, but still reports that it doesn't detect the device type. Then it hits the line VRSettings.loadedDevice = VRDeviceType.Oculus and it magically starts working, which is awesome.

However if i close the application, then run it again, it freezes when it's supposed to switch to oculus. Alt+F4, launch again and it works again.

There may be something wrong on my pc and I'm afraid i don't have another PC to test on, which is slightly frustrating.

EDIT : Okay bodged together a solution!

It seems that for some reason, my built code of unity is unable to detect what VR headset I have connected, but it can detect one is connected, returning a result of empty string for the headset model. Thus i've implemented the following code:

   if(VRDevice.isPresent==true && string.IsNullOrEmpty(VRDevice.model))
          {
              Debug.Log("EMPTY VR DEVICE DETECTED!");
              VRSettings.loadedDevice = VRDeviceType.Oculus;
              VRSettings.enabled = true;
              VRSettings.showDeviceView = true;            
          }   

Which works fine for now. I'm pretty sure the problem is isolated to just my PC since it was working before without a problem so this shouldn't affect too many people.

In the future I will want to add steam VR support so what i'm going to do is change the code above to just display a message of "VR Headset not Recognized" and then have a command line parameter to force on different types of VR headsets.

So for now, I guess I answered my own question... But if anyone figures out why this is happening, please let me and everyone else know.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image evandespault · Apr 12, 2016 at 10:01 AM 0
Share

I ran into this exact issue, and your fix in "EDIT 2" solved the problem.

I'm running Unity 5.3.4p1 with OVRPlugin 1.3 and the latest Oculus runtime and SD$$anonymous$$ (1.3). $$anonymous$$y PC is running Windows 10 and I'm using the D$$anonymous$$2.

avatar image
2

Answer by klaviers · Jun 13, 2017 at 01:46 PM

For me this took rebuilding it with the Windows_64 bit architecture. Then it worked like a champ.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CiccioOrso99 · Jun 23, 2017 at 04:14 AM 0
Share

This may be an old post but this still helped me now, thanks!

avatar image
0

Answer by maicorrales · May 19, 2017 at 01:54 PM

hey man the same thing was happenening to me, so I research all day to fix this problem, and I found that my folder and the .exe have some special characters, so what i did was to to generate a new build in a new folder wihouth the special characters, and that fix the problem. hope this helps.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 3D with Oculus Rift? 2 Answers

Awesomium package + oculus package = nothing is working 1 Answer

Oculus camera moves forward when built 0 Answers

how to make Oculus Touch door opening 0 Answers

Unity Crashing After Building Game 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges