diff --git a/package/Runtime/GaussianSplatURPFeature.cs b/package/Runtime/GaussianSplatURPFeature.cs index b0cc2c1b..d8fa4871 100644 --- a/package/Runtime/GaussianSplatURPFeature.cs +++ b/package/Runtime/GaussianSplatURPFeature.cs @@ -56,6 +56,7 @@ public override void Execute(ScriptableRenderContext context, ref RenderingData } GSRenderPass m_Pass; + bool m_HasCamera; public override void Create() { @@ -67,16 +68,20 @@ public override void Create() public override void OnCameraPreCull(ScriptableRenderer renderer, in CameraData cameraData) { + m_HasCamera = false; var system = GaussianSplatRenderSystem.instance; if (!system.GatherSplatsForCamera(cameraData.camera)) return; CommandBuffer cmb = system.InitialClearCmdBuffer(cameraData.camera); m_Pass.m_Cmb = cmb; + m_HasCamera = true; } public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) { + if (!m_HasCamera) + return; m_Pass.m_Renderer = renderer; renderer.EnqueuePass(m_Pass); }