Unity Editor crashes every time on Play Mode when "Initialize XR on startup" is enabled

I’m experiencing a crash issue in Unity Editor when attempting to enter Play Mode with “Initialize XR on Startup” enabled for Oculus or Open XR. This occurs consistently in my project and also in a brand-new project.

9873924--1423611--upload_2024-6-5_16-49-52.png

Steps to reproduce:

  • Create a new project or open an existing one.
  • Install the latest Meta XR All-in-One SDK (V65).
  • Install Oculus XR Plugin (4.2.0) and XR Plugin Management (4.4.1).
  • In the XR Plug-in Management window, enable “Initialize XR on Startup” for Oculus or Open XR.
  • Enter Play Mode.

Unity version: 2022.3.31f1

Actual result: The Unity Editor crashes immediately after attempting to enter Play Mode, with the last message being “Application.EnterPlaymode”.

Reproducibility: Consistently reproducible in both my existing project and a brand new project.

Additional information: I’ve tried reinstalling the plugins and restarting the Unity Editor, but the issue persists. I’m not sure if this is a bug in the plugins or the Unity Editor itself.

If anyone has encountered a similar issue or has any suggestions on how to resolve this, I’d greatly appreciate your help!

9873924–1423614–Editor.zip (7.54 KB)

I’ve been retesting for a few days and have had a few instances where all my projects, including Unity 2022.3.31f1 and 2021.3.39f1 versions, would enter playmode normally in both Window Standalone and VR mode. This suggests that my original settings in Unity were correct (during those brief periods of normalcy, I didn’t have the VR headset connected, and when I plugged it in, it would link correctly).

However, after exiting Unity and restarting, the issue would reappear, and Window Standalone would crash when entering playmode. I’ve tried killing the adb.exe process using taskkill /F /IM adb.exe after opening the Unity project, and occasionally (about 1/30 or less), one of my 2021.3.39f1 projects would enter playmode normally, but most of the time it would still crash.

It’s been frustratingly inconsistent, as I’ve had a few instances where all my projects would enter playmode normally in both Window Standalone and Android mode. Has anyone else experienced something similar?

If Initialize XR on Startup is checked for desktop mode, I try to be very careful to confirm that my Quest headset is actually Air Linked before I hit play. If the headset isn’t present, Unity will crash pretty much without fail. I’ll often set the headset aside and, not realizing my Link has disconnected and returned to the Quest’s default standalone, will crash Unity by hitting play again. I’ve been trying to get into the habit of hitting play through the headset itself, since that self-confirms the connection.

It’s definitely lacking a valuable layer of robustness. Checking that a headset can be found before launching, maybe disabling the option if not, would presumably save a lot of pain. Like you said though, it can also feel inconsistent and Unity will crash anyway despite my best efforts. I can’t tell if that’s related to the same issue or if it’s another one.

Thanks for pointing me in the direction! I’ve shifted my focus to the Oculus configuration environment and ADB aspects. Since I’ve observed that different versions of Unity can enter Play Mode normally (even linking correctly in the headset), I’m convinced that my Unity settings are fine, and the Oculus plugin and XR plugin management are also working as expected.

I’ve tried reinstalling Oculus ADB Drivers 2.0, but unfortunately, it didn’t fix the issue. I’ve also attempted to enable Play Mode from within the headset, as you suggested, but the result remains the same (I’ve double-checked that the Oculus device info is present in the Build Settings’ Run Device section).

At this point, I’m left to methodically check each possible cause. Over the past few days, I’ve been troubleshooting various issues:

:x: Quest not showing up as a drive on my PC (Unresolved) — I did find that I needed to use SideQuest to enable MTP (Media Transfer Protocol) see the Quest as a drive on my PC. I’m not sure if this is related to the issue,
:heavy_check_mark: I’ve tried swapping out the USB cable,
:heavy_check_mark: updating Oculus to the latest v65,

but the problem persists… It’s really frustrating, but I’ll keep digging until I find a solution. Thanks again for your input!

Same here

Unity version 2022.3.5f1
XR Plugin Management 4.4.1
Oculux XR Plugin 4.0.0
Meta XR Core and others from Meta XR : 65.0.0

1 Like

Same here. I suspect this started to occur after a recent update to the headsets firmware.
I would report a bug, but the unity bug reporter has a bug and just hangs.

I did the following:

  • Download Unity 2022.3.38f1
  • Start a new URP project
  • Add Meta All-In-One asset (v66)
  • Add XR Interaction Plugin (4.4.1)
  • Enable the Oculus plug-in provider (4.2.0)
  • Convert main camera to XR camera rig
  • Press Play

Unity editor crashes. Builds also crash when executed

The same is happening in 2023.2.20f1
This with a project which was known working a few weeks ago. Now, crash on pressing play.

The crash.log shows this towards the end:

0x000002512EF1BD7C (Mono JIT Code) (wrapper managed-to-native) Unity.XR.Oculus.NativeMethods/Internal:SetUserDefinedSettings (Unity.XR.Oculus.NativeMethods/UserDefinedSettings)
0x000002512EF1BB93 (Mono JIT Code) [.\Library\PackageCache\com.unity.xr.oculus@4.2.0\Runtime\OculusPlugin.cs:170] Unity.XR.Oculus.NativeMethods:SetUserDefinedSettings (Unity.XR.Oculus.NativeMethods/UserDefinedSettings) 
0x000002512EF18443 (Mono JIT Code) [.\Library\PackageCache\com.unity.xr.oculus@4.2.0\Runtime\OculusLoader.cs:178] Unity.XR.Oculus.OculusLoader:Initialize () 
0x000002512EF16F63 (Mono JIT Code) [.\Library\PackageCache\com.unity.xr.management@4.4.0\Runtime\XRManagerSettings.cs:190] UnityEngine.XR.Management.XRManagerSettings:InitializeLoaderSync () 
0x000002512EF168DB (Mono JIT Code) [.\Library\PackageCache\com.unity.xr.management@4.4.0\Runtime\XRGeneralSettings.cs:175] UnityEngine.XR.Management.XRGeneralSettings:InitXRSDK () 
0x000002512EF162AB (Mono JIT Code) [.\Library\PackageCache\com.unity.xr.management@4.4.0\Runtime\XRGeneralSettings.cs:148] UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () 
0x00000250B16508C5 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
0x00007FF9FEBF697E (mono-2.0-bdwgc) mono_jit_set_domain
0x00007FF9FEB38444 (mono-2.0-bdwgc) mono_object_get_virtual_method
0x00007FF9FEB38530 (mono-2.0-bdwgc) mono_runtime_invoke
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF9E45AE154)
0x00007FF9E45AE154 (Unity) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF9E4588CF3)
0x00007FF9E4588CF3 (Unity) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF9E41F229F)
0x00007FF9E41F229F (Unity) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF9E41F73FF)
0x00007FF9E41F73FF (Unity) (function-name not available)

I was able to resolve this by uninstalling meta developer hub and meta quest link, then deleting all oculus and meta folders under c:\users\username\AppData\ and c:\program files and reinstalling.

After trying for so long, I finally solved this problem. I think this is also related to the version. I won’t see it in the 2021 version, but it will appear in both 2022 and Unity 6. However, it has finally been resolved.

https://discussions.unity.com/t/oculus-quest-2-and-quest-link-failing-to-start/894265

Hi! I just encountered with the same problem. I’ve spent enormous time but it crashed every time > <
How did you finally fixed it?
My Environment:
Unity 2022.3.0
Meta All-In-One v66
Oculus plug-in provider 4.0.0

My crash is now solved. I realized that I’ve installed UltraLeap Tacking App recently, after I disable its OpenXR Support, the Unity works fine.

A tip: Check if there is another OpenXR runtime service having conflicts with Unity.