Search Issue Tracker
Fixed in 12.0.0
Fixed in 11.0.0
Votes
3
Found in [Package]
2019.4
2020.2
2020.2.1f1
2021.1
2021.2
Issue ID
1304158
Regression
No
[2D][URP] ShadowCaster2D generates about 1.8 KB of Garbage every frame in the Editor
How to reproduce:
1. Open the attached project named "Case_1304158"
2. Open the SampleScene
3. Open the Profiler Window and Enter Play mode
4. In the CPU section, search for PlayerLoop -> Update.ScriptRunBehaviorUpdate -> BehaviorUpdate -> ShadowCaster2D.Update()
5. Observe the GC Alloc statistics
Expected results: ShadowCaster2D does not generate garbage every frame
Actual results: Each ShadowCaster2D object in the Scene generates roughly 1.8 KB of garbage every frame
Reproducible with: 7.5.2(2019.4.19f1), 10.2.2(2020.2.3f1), 11.0.0(2021.1.0b3), 12.0.0(2020.2.0a3)
Could not test with: 2018.4(URP was in early preview stage)
Notes:
1. Does not reproduce in the Build. Attaching a profiler to the Build shows 0 B of garbage generated by ShadowCaster2D.Update()
Comments (3)
-
Garfounkel
Jun 29, 2021 14:48
Will this fix be backported to 2020 LTS release?
-
laserDogRob
Feb 16, 2021 16:12
In the update function of ShadowCaster2D.cs, the first line is:
Renderer renderer = GetComponent<Renderer>();Surely that's a huge problem?
-
DevilCult
Feb 05, 2021 16:50
Got this problem too for over a year i'm trying to find a solution. All my shadowcaster2d are creating at least 1.3kb of GC each. I've seen it in editor mostly but seeing the freeze i get when the shadowcaster get enabled in webgl build make me think it happen there too.
Also by disabling/enabling the component in runtime i cumulativly get more batching, to a point the game will crash.
It need a big look up in general.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Shader Graph Asset icon is not shown on creation unless you confirm the name
- APV Sky occlusion doesn't consider the terrain
- [iOS] "EXC_BAD_ACCESS" Player crash when Script Debugging is enabled
- Cursor skips input fields when tabbing between two sets of input fields
- "Shader error redefinition of 'Varyings'" error appears when selecting the shader
Resolution Note (fix version 12.0.0):
A fix for this issue is available on Universal RP package 12.0.0 and above with Unity 2021.2.0a9
Resolution Note (fix version 11.0.0):
A fix for this issue is available on Universal RP package 11.0.0 and above