Dear All,
I’m working with Unity 2018.4.x. I know that to build a player with support for VR I have to check “Virtual Reality Supported” under Player settings of Unity Editor. But since my application should run with or without VR, I need to enable VR support runtime.
Is XRSettings.enabled the correct flag to set? Should I set it in the Start method of my main script?
Is “360 Stereo Capture” also available from scripting? Where?
Sorry I accidentally used a different forum user to open the case.
I tried running my application with “Virtual Reality Supported” checked and VR device disconnected to try my application without VR. It seems working fine but I can see a critical error on Unity Editor Console (Error 108). The same error appears in a window running my standalone application.
Disconnecting the device, is what I do to test standalone mode without VR. My input checks auto updates to mouse and keyboard if no device is present, or the user is not actively using the headset. There’s no way that I know of to prevent that error, but it can be safely ignored. You might be able to use a CSC file to suppress it if you really wanted to.
I’m sorry but don’t understand exaclty. What is a CSC file? Can you explain it more in detail?
Anyway, do you have “Virtual Reality Supported” checked when you build your application? And, if I understood correctly, you never modify “XRSettings.enabled” by script, right? So that means the application can run normally without VR when no VR device is connected. Is it correct?
Actually my mistake, a CSC file can only suppress warnings not errors. Yes, I always have “Virtual Reality Supported” checked when I build. I never modify XRSettings.enabled, but I do change my input depending on whether a VR device is connected or not.
You can check a whether a device is connected using the XRDevice.isPresent property, or something like the following in 2019.3 and later: