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
- Redoing creation of Sub Scenes and Cube GameObjects in Hierarchy throws “Assertion failed on expression: 'targetScene != nullptr’” error in Console window
- Selecting “New Sub Scene” after assigning “New Scene” in Sub Scene Script Component throws “Destroying GameObjects immediately is not permitted” in the Console window
- Shader Graph "Zoom Step Size" can be set to 0 even though the zoom still works
- Enabling/Disabling the Deprecated Nodes doesn't apply to the opened Shader Graph unless any Variable is added to the Blackboard
- Group Selection title text size is smaller in renaming than the actual font size
Add comment