Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
1
Question by MathijsF · Jun 04, 2018 at 11:39 AM · vrwindowssteam

Enabling VR at runtime does not enable VR controllers

When we load VR at runtime, using code similar to the documentation (https://docs.unity3d.com/ScriptReference/XR.XRSettings.LoadDeviceByName.html), the VR headset works but the VR controllers don't get enabled.

We're using the default SteamVR CameraRig prefab.

It does work when we load VR at the start, without code, by only having 'OpenVR' in the Project Settings -> Player -> XR Settings.

It breaks when we add 'None' to that list above 'OpenVR'. It then starts without VR, then we call XRSettings.LoadDeviceByName and XRSettings.enabled. Again, the camera then works fine, but no controllers.

Manually enabling the controllers does not work (they get an invalid ID). Calling SteamVR_ControllerManager.Refresh() or SteamVR_ControllerManager.UpdateTargets() also does not fix it.

Any tips?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by eatbuckshot · Aug 01, 2018 at 04:59 AM

I have the same issue, this has worked at least prior to Unity 2018.x.x I would load with "None, OpenVR, Oculus" in the player settings then in code

 UnityEngine.XR.XRSettings.LoadDeviceByName(new string[] { "OpenVR", "Oculus", "None" });
 yield return null;
 UnityEngine.XR.XRSettings.enabled = true;

i believe it may even cause unity to crash in a standalone. and the editor log would spam

 Assertion failed on expression: 'IsMatrixValid(matrix)'
 Screen position out of view frustum (screen pos 0.000000, 0.000000, 1.000000) (Camera rect 0 0 512 531)
 Screen position out of view frustum (screen pos 512.000000, 0.000000, 1.000000) (Camera rect 0 0 512 531)

even calling SteamVR.Enabled after words doesn't seem to reinitialize it

This is using the Assetstore version of SteamVR (SteamVR plugin for UNITY v1.2.3)

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 eatbuckshot · Aug 01, 2018 at 09:56 AM 0
Share

From some research, I read that the issue has to do with having the scripts on the CameraRig prefab run before VR is enabled. The workaround is to make sure they don't exist before VR is set to enabled. This could be done by instantiating a the CameraRig prefab only after s$$anonymous$$mvr and XR gets enabled. Which likely needs at least a frame to be finished, so a 2nd yield return null after enabling i believe..

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

117 People are following this question.

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

Related Questions

Mixed Reality (Odyssey) controllers not tracking with SteamVR interaction system! 0 Answers

Show Open File panel in Unity SteamVR application 0 Answers

Editor Crashes When Switching from VR to Standalone 0 Answers

Camera and objects in steamVR plugin 0 Answers

,Cloned TeleportArea not working 1 Answer


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