The value of stripShadowsOffVariants being true triggered the creation of RenderTexture in SetupForEmptyRendering, causing GC. Why is this?


This is the SetupForEmptyRendering method in MainLightShadowCasterPass. Our project has disabled shadow rendering for the main light; therefore, the value of renderingData.shadowData.supportsMainLightShadows is false. This triggers SetupForEmptyRendering to execute the function that creates RenderTexture, causing a small amount of GC every couple of frames. Can you explain why this happens? The value of renderingData.cameraData.renderer.stripShadowsOffVariants is True; does it mean that the shader variants are being stripped?

@AlanParrick For Stripping disabled variants. You can learn about this topic from [2022.1] Add Shadow and Additional light variant stripping by lukaschod · Pull Request #5544 · Unity-Technologies/Graphics · GitHub