Hi everyone,
I’m encountering an issue related to the XR Interaction Toolkit when I run and then exit Play Mode. Specifically, I get the following error in the console:
texture didn’t exist or already freed
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
My Notebook:
AMD Ryzen 9 6900HX
32 GB RAM
AMD Radeon RX 6850M XT
Meta Quest 3
The issue occurs when:
- I press Play to run the game.
- Everything works fine while the game is running.
- When I stop Play Mode (exit the game), the error appears.
What I’ve Tried:
- I’ve ensured that all my XR-related packages (XR Interaction Toolkit, OpenXR, etc.) are up to date.
- I switched to the latest Unity version LTS Version 2022.3.46f1.
- The error also occurs in the default XR Interaction Toolkit DemoScene, so it’s not something specific to my project.
I’ve also tried manually stopping the XR subsystems in OnApplicationQuit()
and when exiting Play Mode, but the issue still persists.
Here’s a relevant snippet of my debugging code for tracking the destruction of XR subsystems:
protected void DestroySubsystem<T>() where T : class, ISubsystem { T subsystem = GetLoadedSubsystem<T>(); // Debug output before destruction if (subsystem != null) { Debug.Log("Subsystem before destruction: " + subsystem.GetType().Name); } else { Debug.Log("Subsystem is already null or not present."); } if (subsystem != null) { var subsystemType = typeof(T); if (m_SubsystemInstanceMap.ContainsKey(subsystemType)) { m_SubsystemInstanceMap.Remove(subsystemType); } subsystem.Destroy(); // Debug output after destruction Debug.Log("Subsystem after destruction: " + (GetLoadedSubsystem<T>() == null ? "Successfully destroyed" : "Still active")); }
}
The subsystems seem to be destroyed correctly (as indicated by my log messages), but the “texture didn’t exist or already freed” error keeps appearing after the XR subsystems (like XRInputSubsystem
and XRDisplaySubsystem
) are destroyed.
My Question:
Has anyone encountered a similar issue with textures being released or attempted to be accessed after XR subsystems are destroyed? Are there any recommended ways to ensure that textures are properly handled when exiting Play Mode, especially in XR setups?
I appreciate any advice or potential solutions you might have!
Thanks in advance for your help!
Best Regards
Jan
Update 09/14/2024
I have now tested the issue on another laptop (Razer Blade 16, Geforce RTX 4080 - Intel Core i9-13950HX), and the exact same problem occurs. I also manually updated my XR Interaction Toolkit to version 3 (3.0.5), but the error persists.