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
- PlayerPropertiesChanged event fires before Player Properties are applied
- Opening Media Pop-out in “Before You Start” Tutorial throws “Styles” and “Styles_Dark” messages in the Console window
- Play Mode Scenario selection/highlight is too long and out of its bounds when the Play Mode Scenario window is opened after maximizing
- Asset name is not shown in the Undo History window when a sprite is modified
- Moving a Tab to a floating window fails when floating windows are docked next to each other
Add comment