What should I do for lights that are spawned when playing? It shows “5000” objects not built, and it makes my game extremely slow. Is there anything I can do, or I have to add them before the game starts?
make sure cast shadows is disabled
Make sure they are dynamic, if you get unbuilt lighting warnings you might be trying to spawn static or stationary lights.
Like mserena mentioned, shadows are indeed by far the most expensive part of a dynamic light, so limit their use. However, if you do need them, try to use them on spotlights instead of pointlights. Pointlights require six shadow maps to cover their full range, while spotlights only need one, making them quite a bit cheaper.
Finally limit your light radii. Dynamic lights without shadows are quite cheap, their main cost is the number of pixels they can influence, so try to keep their radius as small as possible. Because of this a hundred tiny lights might be cheaper to render than a single light that covers the whole map. To visualize this you can use the light complexity viewmode.
The change to dynamic lights solved it for me. Many thanks