Better Way to Instantiate 2D URP Light?

Hello,
I am working on a 2D side scrolling platformer/runner in which I am utilizing 2D URP lighting.
Parts of my level are randomly generated, and one of those parts is hanging light fixture that utilizes a 2D spot light as the lighting source. Currently, I am noticing a correlation between a lag spike (<30FPS) in the profiler and the instantiation of this spot light.

Instead of using instantiate, I created a few of these lights in the hierarchy and placed them out of view and just moved their transforms when I needed them on screen but I noticed the same lag spike whether I used instantiate or the move method.

I am hoping someone has a suggestion for a better way to do this, or could point out something I may be doing incorrectly. Thank you


1 Like