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|https://unity.slack.com/archives/C06TQE31T/p1685503287227009?thread_ts=1685488281.870979&cid=C06TQE31T]
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
- ACES Tonemapping causes banding artifacts and negative values in ColorGradingLUT when HDR is enabled and "High Dynamic Range" Grading mode is selected while Android Platform is used
- Android Player freezes when an Audio Source is playing and an incoming call is picked up and then hung up and the Audio Source is started again
- Green success icon is poorly visible in the light Unity theme
- Incorrect input into the Input Field when using Microsoft IME Japanese
- Multiplayer role "ClientAndServer" is displayed without the spaces in the "Play Mode Scenarios" window
Add comment