IndexOutOfRangeException: renderPassIndex
UnityEngine.XR.XRDisplaySubsystem.GetRenderPass (System.Int32 renderPassIndex, UnityEngine.XR.XRDisplaySubsystem+XRRenderPass& renderPass) (at <933cbd6bc9f14e5d819ef1b17372e9fa>:0)
UnityEngine.Rendering.Universal.XRSystem.CreateLayoutFromXrSdk (UnityEngine.Camera camera, System.Boolean singlePassAllowed) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.7/Runtime/XR/XRSystem.cs:331)
UnityEngine.Rendering.Universal.XRSystem.SetupFrame (UnityEngine.Camera camera, System.Boolean enableXRRendering) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.7/Runtime/XR/XRSystem.cs:190)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.7/Runtime/UniversalRenderPipeline.cs:528)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@12.1.7/Runtime/UniversalRenderPipeline.cs:265) UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List
1[T] cameras) (at :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 :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
官方描述
查了一下,renderPassIndex是渲染通道的索引(最初传入到 XRDisplaySubsystem.GetRenderPass)。
解决方法
我的启动场景中只放了启动框架,并没有放相机,当放入相机后就不会报错。
至于为什么报这个错,渲染通道为什么越界,就不太清楚了,引擎的代码没有研究过。
使用XR时渲染管线报错IndexOutOfRangeException: renderPassIndex
于 2023-02-24 09:41:57 首次发布