Search Issue Tracker

Fixed in 12.0.0

Fix In Review for 7.x.x, 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

Package: Scriptable Render Pipeline Universal

-

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()

  1. Response avatar

    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

Comments (3)

  1. 9e3c8b8775af692121e3f4372d318a3c?d=mm

    Garfounkel

    Jun 29, 2021 14:48

    Will this fix be backported to 2020 LTS release?

  2. 75397a2925c9550d59cfa27ab7320cac?d=mm

    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?

  3. C7945644b4f9da041cd777c5f2700cd4?d=mm

    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

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.