Performance Problems with URP & 2D Lighting/Shadow on Mobile Devices

Hello,
I’m currently using 2021 alpha version. I’m currently developing a 2D mobile game and testing on Galaxy S6(Android) as my base device. I’m using OpenGL ES3. I was using the built-in render pipeline but switched to URP to use 2D lighting and shadows. With built-in RP I can get a stable 60 fps while URP reduces it to 20fps. I have a global light and two point lights, also several objects have 2D shadow caster script on them. But the shadows are limited inside the same sorting layer. I’ve read that sorting layer count reduces performance greatly, I have 10 atm. I also have one custom shader graph for swaying plants, that’s all. But then again, they say 2021 version has increased performance with mobile devices but I didn’t see that performance difference.

Should I give up using URP for Android and continue with built-in RP? Should I add fake lighting and shadows via sprite shapes to have smooth gameplay on mobile? URP does wonders visually, I would really like to solve this performance problem and use it.

I suggest you try to customize the package locally and wait for some update to land. There’s a really simple optimization to perform on ShadowCaster2D.cs.
This GetComponent should be in Awake. It’s the most significant lag from ShadowCasters.

1 Like

I finally found the culprit, it was HDR and the global light in the scene. Currently, I can use URP with stable 60fps and It’s even more smooth and more performant than SRP but even though I don’t have any shadow casters in the scene, I can’t use any form of 2D lighting due to performance problems. Maybe I should play with render pipeline asset values a bit more.