Removing XR support from URP

Issue Description

I previously integrated XR Plugin Management into my project, and later removed the related packages via the Package Manager. Currently, while testing the project, we are using URP (Universal Render Pipeline) and Cinemachine. When running the game in the Game window with Gizmos enabled in the IDE, two reports are triggered: a warning (XRSystem.ReleaseFrame() was not called! UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)) and an exception (AssertionException: Editor camera must resolve target upon finish rendering. Assertion failure. Value was False Expected: True).

Reproduction Steps

  1. Enable Gizmos in the Game window during play mode.
  2. Observe the warning and exception being triggered.

Expected Outcome

Gizmos should work without triggering warnings or exceptions.

Test Scenarios and Findings

  1. Disabling Cinemachine and Camera: Disabling these components prevents the warning and exception when Gizmos are enabled.
  2. Server Mode: Enabling Gizmos in Server mode does not trigger the warning or exception.
  3. Client Mode: Disabling Gizmos for Cinemachine in the Gizmos rendering options does not prevent the warning and exception in Client mode.

Summary

We suspect that after removing the XR Plugin package, URP still references some XR configurations, causing it to run the XRSystem script (Debug.LogWarning("XRSystem.ReleaseFrame() was not called!"); at line 171). We need guidance on how to completely remove XR support from URP. This issue affects the use of the Gizmos tab in the Game window during client mode testing.

Environment

  • Unity Version: 2021.2.4f1c1
  • Platform: Android

Relevant Code/Error Logs

plaintext

复制代码

AssertionException: Editor camera must resolve target upon finish rendering. Assertion failure. Value was False Expected: True
UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) (at <b1bda145be2a466a83211d2ed15d29ea>:0)
UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) (at <b1bda145be2a466a83211d2ed15d29ea>:0)
UnityEngine.Rendering.Universal.UniversalRenderer.Setup (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.1/Runtime/UniversalRenderer.cs:853)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.CameraData cameraData, System.Boolean anyPostProcessingEnabled) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.1/Runtime/UniversalRenderPipeline.cs:410)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.1/Runtime/UniversalRenderPipeline.cs:562)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.1/Runtime/UniversalRenderPipeline.cs:264)
UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <b1bda145be2a466a83211d2ed15d29ea>:0)
UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, System.Collections.Generic.List`1[T] renderRequests, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <b1bda145be2a466a83211d2ed15d29ea>:0)
UnityEngine.GUIUtility:ProcessEvent (int, IntPtr, bool&)

Request for Help

We need assistance in completely removing XR support from URP as it seems to be causing the warning and exception related to the XRSystem script. This issue impacts our ability to test the Game window Gizmos option in client mode. Any guidance on resolving this issue would be greatly appreciated.

1 Like

After multiple tests, we have finally resolved the issue. First, the exception and warning were not caused by references to Cinemachine and XRPlugin. Using different computers, we reproduced the bug and found that in Unity 2021.2.4f1c1 with URP 12.1.1, creating a UICamera and setting it to overlay mode, then stacking it on the main camera, and running the game in the editor while having Gizmos enabled will trigger the reported exceptions and warnings.

Our temporary solution is to deprecate the UICamera and set the Canvas to Screen Space - Overlay mode. By avoiding the use of URP’s camera stacking technique, we managed to bypass this bug. We hope future versions of Unity and URP will address this issue. Additionally, note that there might be an incorrect usage of the overlay mode for the URP camera on our part, so using UICamera with overlay mode should be handled carefully.

Moreover, RedVonix’s comment in the thread https://forum.unity.com/threads/a16-a17-assertionexception-editor-camera-must-resolve-target-upon-finish-rendering.1119244/ provided me with significant insights. Thanks to this community member and the thread’s host.