How to spawn multiple actors without taking performance hit?

So i got this problem when spawning multiple actors, every time i spawn multiple actor it take a huge performance hit, Surprisingly not much on IOS but Android and the editor it pretty notable, it there any other way for better spawning multiple actor without tacking performances hit ?

I reduce the amount of actor and that seem to fix it a little bit, but i need to spawn more without taking a performance hit. ¿Any idea ?

BTW i was following this unreal tutorial : BP Twin Stick Shooter: Spawning Enemies | 14 | v4.8 Tutorial Series | Unreal Engine - YouTube

1 Like

are you spawning them during gameplay? Like a wave defense, if not just make all your spawns during the loading screen, if you are doing during game play try spawning them in super short timer so its not all on a single frame

here is a couple of ways, one a event which fires every 10 frames to check how many need to be spawn and spawns one, the second one. If you want to put it into any sort of event you want set a delay after each one. I set mine on a button event. .1 means 10 frames, you can also put 0 which gets you a single frame skip for the timer or the delay, but a timer firing that fast we take performance with any sort of substantial math

1 Like

I am having the same problem so I am planning to use a pool. So every time you destroy an actor it get backs to the pool waiting to be used again. What is bringing the performance down is the creation of a new instance but once is created and loaded to the gpu ram is easy to modify and reuse. Just creste a blueprint with an array to keep them and methods to push and pop or a global variable. You can set an initial size of actors to be create at start anf if you run low you can create just few more

Have been thinking for a while on how I can make my endless runner more efficient and this pool is a really good idea, thank you!

1 Like