fps drop when using too many 2d light

hello, guys i need help
when I put many 2d lights on my scene I had a drop in fps when i build and run the game in android
i have make a fps UI reader to see my fps, it starts with 60fps and after my player pass from 2d lights the fps drop to 20fps.
I use a universal render pip line with 2d renderer.


here my FPS start is 30
i have write
Application.targetFrameRate = 60;
but didnt work

Here is how to begin your performance problem investigation:

Always start by using the profiler:

Window → Analysis → Profiler

Failure to use the profiler first means you’re just guessing, making a mess of your code for no good reason.

Not only that but performance on platform A will likely be completely different than platform B. Test on the platform(s) that you care about, and test to the extent that it is worth your effort, and no more.

Remember that optimized code is ALWAYS harder to work with and more brittle, making subsequent feature development difficult or impossible, or incurring massive technical debt on future development.

Notes on optimizing UnityEngine.UI setups:

At a minimum you want to clearly understand what performance issues you are having:

  • running too slowly?
  • loading too slowly?
  • using too much runtime memory?
  • final bundle too large?
  • too much network traffic?
  • something else?

If you are unable to engage the profiler, then your next solution is gross guessing changes, such as “reimport all textures as 32x32 tiny textures” or “replace some complex 3D objects with cubes/capsules” to try and figure out what is bogging you down.

Each experiment you do may give you intel about what is causing the performance issue that you identified. More importantly let you eliminate candidates for optimization. For instance if you swap out your biggest textures with 32x32 stamps and you STILL have a problem, you may be able to eliminate textures as an issue and move onto something else.

This sort of speculative optimization assumes you’re properly using source control so it takes one click to revert to the way your project was before if there is no improvement, while carefully making notes about what you have tried and more importantly what results it has had.

See the option on your 2D Renderer Data called Light Renderer Textures? Try decreasing that the Render Scale. That’s sometimes a significant performance gain.

Other than that, try to reduce the number of lights, reduce the number of different light layers, and reduce the size of the lights.

Looking at the screenshot, it says 1920x1080. On mobile, make sure it’s actually using a lower resolution than that because many devices cannot handle that many pixels.

1 Like