When you start the game there are small friezes, there are quite a lot of objects on the stage.

Statistics:

enter image description here

Profiler:

enter image description here

And half of these objects are created and deleted on the stage!

  • @Stranger in the Q What does pool mean? - Aimon Z.

1 answer 1

Judging by the screenshot from the profiler, you always go to V-Sync

You can control this here, try turning off vertical sync:

Edit->Project Settings->Quality->VSync Count. 

Vertical synchronization (V-Sync) - synchronization of the frame frequency in a computer game with the frequency of the vertical sweep of the monitor. In this case, the maximum FPS with vertical synchronization is equal to the monitor refresh rate.


Also try using a pool of objects.

Implementation for Unity is in AssetStore - LeanPool

But in general, the approach is quite simple, you can also implement something similar, the meaning is not to generate new objects, but to take them out of the pool, and not destroy them, but fold them back into the pool, but only generate them when they are out of pool ( there could be any other logic handling the overflow).

  • Cool! I'll check it out and if the friezes disappear, I’ll put the "Right answer" - Aimon Z.
  • @AimonZ. not the fact that friezes will disappear, but for the sake of interest, attach a screen from the profiler after applying the changes - Stranger in the Q
  • It only got worse - Aimon Z.
  • Look here, then: Edit-> Project Settings-> Quality-> VSync Count. try to disable vsync - Stranger in the Q
  • It helped! You can issue as an answer so I set you as the correct one. And yes that gives this VSync Count - Aimon Z.