Search Issue Tracker
Fixed
Fixed in 2021.3.29f1, 2022.3.5f1, 2023.1.5f1, 2023.2.0a22
Votes
1
Found in
2021.3.27f1
2022.3.1f1
2023.1.0b19
2023.2.0a18
Issue ID
UUM-37441
Regression
No
[2D] [URP] Objects are rendered twice when Foremost Sorting Layer is enabled
Reproduction steps:
1. Open the “SortingLayerStripped“ project
2. Open the “SampleScene“ scene
3. Open and enable the Frame Debugger
Expected result: There is a single “RenderLoop.Draw” frame
Actual result: There are two “RenderLoop.Draw” frames
Reproduced in: 2021.3.27f1, 2022.3.1f1, 2023.1.0b19, 2023.2.0a18
Reproduced using: macOS 13.3.1 (Intel), Windows 11
Notes:
1. Also reproduced in Standalone Development Player
2. Reproduced when any of the Sorting Layers of the objects placed in the scene match the Foremost Sorting Layer
3. Not reproduced when there is no Sorting Layer that matches the Foremost Sorting Layer
4. Not reproduced when placing a Global Light 2D in the scene
5. Internal discussion confirming it’s a bug
6. Code diff between Global Light 2D and no Global Light 2D
6.1. With Global Light 2D (“Render2DLightingPass.cs” line 299)
{noformat}
if (cameraSortingLayerBoundsIndex >= layerBatch.layerRange.lowerBound && cameraSortingLayerBoundsIndex < layerBatch.layerRange.upperBound && m_Renderer2DData.useCameraSortingLayerTexture)
{
filterSettings.sortingLayerRange = new SortingLayerRange(layerBatch.layerRange.lowerBound, cameraSortingLayerBoundsIndex);
Render(context, cmd, ref renderingData, ref filterSettings, drawSettings);
CopyCameraSortingLayerRenderTexture(context, renderingData, copyStoreAction);
filterSettings.sortingLayerRange = new SortingLayerRange((short)(cameraSortingLayerBoundsIndex + 1), layerBatch.layerRange.upperBound);
Render(context, cmd, ref renderingData, ref filterSettings, drawSettings);
}{noformat}
6.2. Without Global Light 2D (“Render2DLightingPass.cs” line 433)
{noformat}
if (m_Renderer2DData.useCameraSortingLayerTexture)
{
filterSettings.sortingLayerRange = new SortingLayerRange(short.MinValue, m_CameraSortingLayerBoundsIndex);
Render(context, cmd, ref renderingData, ref filterSettings, unlitDrawSettings);
CopyCameraSortingLayerRenderTexture(context, renderingData, storeAction);
filterSettings.sortingLayerRange = new SortingLayerRange(m_CameraSortingLayerBoundsIndex, short.MaxValue); <= No add to +1.
Render(context, cmd, ref renderingData, ref filterSettings, unlitDrawSettings);
}{noformat}
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Add comment