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()
-
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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