How to auto-select VR or desktop access mode
Many enterprise applications need to be able to run in both VR and desktop modes, depending on the device and context in which they are being used. Manually selecting the correct VR mode can be time-consuming and error-prone, particularly in complex, multi-device environments.
By using Innoactive Portal's launch arguments, organizations can easily and automatically select the correct VR mode for an application, ensuring that it runs smoothly and effectively for all users. This saves time and reduces the risk of errors, improving the overall efficiency and effectiveness of enterprise XR applications.
Before going through this How to, we recommend to read How to use launch arguments.
Suggested approach
Our suggested approach is to leverage on default arguments:
So first enable default launch arguments in Portal Control Panel, then implement this code:
if(GetArg("--portal-interface-mode") == "vr") {
EnableVRRig();
Debug.Log("Activating VR mode");
} else {
EnableDesktopRig();
Debug.Log("Activating Desktop mode");
}
--portal-interface-mode <vr|screen>
will react based on the option that has been chosen during the app launch on Portal (or via deep link).
Launching via cloud or launch?device=cloud
would result in:
--portal-interface-mode vr
Launching via cloud or launch?device=browser
would result in:
--portal-interface-mode screen