We're trying to create an app (iOS and Android) that is able to swap between Cardboard and Gyroscope control. We're doing this via a script that looks like this:
(Based on the script found in the [VRSettings.LoadDeviceByName][1] documentation.)
IEnumerator LoadDevice(string newDevice)
{
VRSettings.LoadDeviceByName(newDevice);
yield return null;
if (!(newDevice == string.Empty)) {
VRSettings.enabled = true;
}
else
{
VRSettings.enabled = false;
}
}
However we're encountering some problems with loading new devices. We're swapping the devices using a toggle script, and running the above as a Coroutine. What's been happening is on the first toggle, GoogleVR gives some errors:
05-01 10:57:21.845 7774 7774 E Unity : Error trying to call delegated method unload. null
05-01 10:57:21.846 7774 7774 E Unity : Google VR Error [Cardboard]: Exception caught while loading GoogleVR. Attempt to invoke virtual method 'java.lang.Object com.unity3d.player.l.a(java.lang.String, java.lang.Object[])' on a null object reference
05-01 10:57:21.846 7774 7800 E Unity : Google VR Error [Cardboard]: Google VR had a fatal issue while loading. VR will not be available.
The app functions as expected, just without a cardboard viewer. However, if you toggle back to gyro controls and then back to cardboard, it shows the expected cardboard viewer, but unity now spams this error to the console:
05-01 11:00:41.160 7774 7800 E Unity : OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_VALUE: Numeric argument out of range
05-01 11:00:41.160 7774 7800 E Unity :
05-01 11:00:41.160 7774 7800 E Unity : (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 366)
After a few seconds of this, the application quits without an error code or a "App stopped unexpectedly" window. We are not using any custom plugins and are not using the GoogleVR Unity plugin as the native
plugin performs all the functions we need it to (Additionally we did install the GoogleVR Plugin to see if it would fix our issues, it did not). Any help at all would be great, thanks.
[1]: https://docs.unity3d.com/ScriptReference/VR.VRSettings.LoadDeviceByName.html
↧