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 /
  • Help Room /
avatar image
2
Question by nice-nate · Apr 07, 2017 at 05:11 AM · vrgooglesplash screen

How to disable VR on Unity Splash Screen while Google Cardboard is enabled

Question in title. Currently I am fooling with the following code:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.VR;
 
 public class StartVRDisabled: MonoBehaviour {
     [RuntimeInitializeOnLoadMethod]
     static void OnRuntimeMethodLoad()
     {
         VRSettings.enabled = false;
     }
 }

I am really unsure of how to apply script to the splash screen, or apply script which works during the initialization of the app.

Any help is appreciated.

Comment
Add comment · Show 1
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 nice-nate · Apr 10, 2017 at 04:55 PM 0
Share

Still need help on this. From looking around online it seems that Unity Personal has no custom scripting capabilities. Will continue searching.

1 Reply

· Add your reply
  • Sort: 
avatar image
7

Answer by Liinnkk · May 16, 2017 at 07:08 PM

The only way I found to disable VR in splash screen is to start the game in a non-VR mode and then change it to Cardboard (or any other VR device) at runtime. According to VR Overview documentation you can do it setting the "None" VR SDK as your first SDK of the Supported VR SDK list and through the VRSettings.LoadDeviceByName() command. Here's the quote:

Including None as a device in the list allows you to default to a non-VR application before attempting a VR device’s initialization. If you place None at the top of the list, the application starts with VR disabled. Then, you can then enable and disable VR devices that are present in your list through script using VRSettings.LoadDeviceByName.

The setup should look like this: alt text

Since the VRSettings.LoadDeviceByName() loads the requested device at the beginning of the next frame, you should call VRSettings.Enable() in the next frame, as soon as device is loaded. You can use this example code available on the command documentation.

 // Run in split-screen mode
 
 using System.Collections;
 using UnityEngine;
 using UnityEngine.VR;
 
 public class RuntimeCardboardLoader : MonoBehaviour
 {
     void Start()
     {
         StartCoroutine(LoadDevice("cardboard"));
     }
 
     IEnumerator LoadDevice(string newDevice)
     {
         VRSettings.LoadDeviceByName(newDevice);
         yield return null;
         VRSettings.enabled = true;
     }
 }

Assign this script to a GameObject called CardboardLoader or something like this and put your CardboardLoader in the first scene after the Splash Screen. It should work.

Warning: As stated in this thread there's a leak problem on Google NDK 1.2, which is used by Unity 5.6 when you go in and out of VR. So if you're using Unity 5.6 and want to use the LoadDeviceByName() method, upgrade your Unity to a newer version (in this moment, Unity 2017.1.0b5).


vrconfig.png (4.4 kB)
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

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

118 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 avatar image

Related Questions

Google Cardboard App not being 360 1 Answer

Unity to iOS VR (via Google Cardboard) - screen is squashed 0 Answers

GoogleVR / C# - How to, with the "pointer click": click 1 move a cube and click 2 move back the cube 0 Answers

How do I move forward & raycast based on the MainCamera direction (in UFPS) 0 Answers

Google Cardboard VR + GazeInputModule - Get trigger events when not over UI 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