Download

How to Reuse Characters

I’m currently working on a game where I will be spawning up to a few hundred characters. This is a mobile game and I know devices should be able to handle a few hundred characters at a time. But I would like to create a pool to store characters when they aren’t needed so I can reuse them instead of spawning all the time. My characters are Paper Characters. I wasn’t able to find a lot in Googling but I found one possible way to do it. I would like to check and see if this is a good way or if there is a better way to reuse actors.

If the pool is empty I will spawn a new character and if its not I will reuse one that is in the pool. When I am done with a character and place it back into the pool I will disable the actor tick, disable collision, and set all the components visibility to hidden or collapsed. Then when I’m ready to take one from the pool I will just reverse those settings. I’m under the assumption that if I call DestroyActor on it I will no longer be able to reuse it. So I would like to know if this assumption is correct and if there is a better way to reuse a paper character?

Don’t fix what ain’t broke.

I haven’t made it to the point yet of testing that process, so it should work to allow me to reuse the characters?

Just spawn and destroy the characters as needed. If you find performance issues, then worry about keeping pools.