app with XR mode optional
Unity 2020.9.1f1
“com.unity.xr.management”: “3.2.16”
Windows Build
il2cpp
What XR provider are you targeting?
i target these 3 with one build
“com.unity.xr.oculus”: “1.5.0”,
“com.unity.xr.windowsmr”: “4.0.2”,
“com.valvesoftware.unity.openvr”: “1.0.1”,
it might be happening because i have this set m_InitManagerOnStart: 1
and launching with -vrmode none
is a workaround that returns false here
private bool CheckGraphicsAPICompatibility(XRLoader loader)
for all loaders
this was working without the log hang so might just roll back “com.unity.xr.management”
Is this a build time or runtime error you are seeing? What happens if you disable the different providers? I’m pretty sure that error doesn’t come from management or WMR so wondering if Oculus or OpenVR are throwing int.
runtime of build with “-vrmode none” launch params
which means none of the 3 loaders have been init
Initialize() is only allowed if CheckGraphicsAPICompatibility returns true for that loader
“com.unity.xr.management” → XRManagerSettings.cs → CheckGraphicsAPICompatibility
That command line flag (-vrmode) was for legacy XR and does not do anything for XR SDK based applications.
i added support
// add this method
public bool app_launch_args_contain(string value)
{
var args = System.Environment.GetCommandLineArgs();
for (int i = 0; i < args.Length; i++)
{
if (args[i].IndexOf(value, System.StringComparison.OrdinalIgnoreCase) >= 0)
return true;
}
return false;
}
// above this existing method
private bool CheckGraphicsAPICompatibility(XRLoader loader)
{
// add this
if (app_launch_args_contain("-vrmode"))
{
if (app_launch_args_contain("none")) { return false; }
else if (app_launch_args_contain("openvr"))
{
if (loader == loaders[0]) { return false; } // OpenVR is 2nd
}
else if (app_launch_args_contain("windowsmr"))
{
if (loader == loaders[0]) { return false; }
if (loader == loaders[1]) { return false; } // WindowsMR is 3rd
}
}
// before existing method contents
GraphicsDeviceType deviceType = SystemInfo.graphicsDeviceType;
List<GraphicsDeviceType> supportedDeviceTypes = loader.GetSupportedGraphicsDeviceTypes(false);
// To help with backward compatibility, if the compatibility list is empty we assume that it does not implement the GetSupportedGraphicsDeviceTypes method
// Therefore we revert to the previous behavior of building or starting the loader regardless of gfx api settings.
if (supportedDeviceTypes.Count > 0 && !supportedDeviceTypes.Contains(deviceType))
{
Debug.LogWarning(String.Format("The {0} does not support the initialized graphics device, {1}. Please change the preffered Graphics API in PlayerSettings. Attempting to start the next XR loader.", loader.name, deviceType.ToString()));
return false;
}
return true;
}
I’m not sure why you are doing this? What is it that you are even trying to achieve with these changes? Why not just disable InitMangerOnStart and manually start the system?
could only get builds to work consistently with InitMangerOnStart set to true; toggling XR mode would also cause issues
so this is my workaround
also when i added support there wasn’t any other way to choose which loader to load
has this changed?
Did you use the XR Plug-in management UI? Not sure what you mean by “choose which loader to load”?
thank you for your help
by adding that code i can use the same build to launch any vr mode
“-vrmode none” “-vrmode openvr” etc.
choosing any of the loaders to init first
how can i do that without my edits?
I do not recommend (and Unity does not support) hacking the management script direclty.
For in editor, you can change the Loader List at any time using script. You can also do that in a build script when you generate player builds. The loader list on XRGeneralSettings is modifiable, and there are many threads in this forum with people doing just that. Shouldn’t be too hard to find one if you search around.
Runtime support for this is not available at this time. If this is what you want to do at runtime then you might as well disable the InitManagerAtStart and manually control the loader you wish to use yourself.
thank you; runtime is easiest for me;
for anyone else having this issue:
“com.unity.xr.oculus”: “1.5.0” …
from the new OculusPlayerLoop file
We are now seeing the same
[XR] Error determining if we should quit: Not Initialized
on our server build … this wasn’t an issue till this build
what causes this message to print we cant find it by simply searching
@Loden_Heathen_1 the cause is this line
if (NativeMethods.GetAppShouldQuit())
inside
Library\PackageCache\com.unity.xr.oculus@1.5.0\Runtime\OculusPlayerLoop.cs
Package Manager → Oculus XR Plugin
they use this hook
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
instead of hooking inside the override Initialize() method of there XR loader file…
the easiest workaround is downgrading to
“com.unity.xr.oculus”: “1.4.3”
which can be done editing the version number in
Packages\manifest.json
if the option isn’t available here
Package Manager → Oculus XR Plugin
Thank you for the responce we determined it to be a bug on Unity’s part our selves where in the Oculus XR Framwork plugiin is now a problem. It wasn’t in the previous version.
So for now we have removed Oculus plugin support in hopes they will patch it up before we need it. Our app supports non-VR as well as multiple VR platforms so we can work around Oculus not being supported for a bit
yea mine too and I prefer to have 1 build that does it all with launch params
reported it to Oculus on 23rd here (https://developer.oculus.com/bugs/)
no response yet
Ya saw I think a couple of people pointing it out. In our case the user can go in and out of VR during a session so launch params wont work for us rather we have to test at run time is the user going in or out of a VR experance and we do the nessisary work to spin up or shut down the XR presentation subsystems.
Granted with Oculus since its standalone it will always start and stay in Oculus assuming its not being used with PC … Oculus honistly is an odd one with that. I do wish Unity had a bit better support for the concept of going in and out of VR. Our own experance is that VR while cool and all is also tiering and its nice to be able to pop into and out of VR in game play without needing to shut down and reload. Our approch does work with the XR Framework they have but it feels really hackish to do simple things like detect if we are currently in VR, is a VR device available and ready to use, and to shut down VR when the user wants.
So I still see this issue in Unity 2019.4.20
The log is just full of the message when we have not tried to go into VR (user can enter or exit as want)
Edit: However I think it may have been fixed in 1.6 or 1.7 as updating the plugin seems to stop it
Hi,
Please see this thread for more information. [XR] Error determining if we should quit: Not Initialized