Not using enough CPU resources Bug

There aren’t any specific rules for poolers.

The pooler itself is just an actor with a TArray of type UObject or AActor
You set an int32 variable to the amount of objects (for instance 100 bullets)
in the begin play you go through a for loop and spawn all bullets up front and add them to the array.

Usually pooled objects would need an interface (eg. IPooledObject) with commands
Activate - initialize object
Deactivate - that let them return to the pool instead of destroying them.

During activation:

loop through the pooler array and check if an item has its active bool set to false, if so call the activate interface on it & break from the loop returning the new object

  • turning on their rendering, physics, could also be projectile movement component settings in the case of bullets)
  • their active bool is set to true

During deactivation:

  • their physics is deactivated and rendering and collision turned off.
  • their active bool is set to false
  • their position is set to the master pooler position

I have an old system somewhere buried in older projects I might be able to extract later on.

Just remembered I made an simple version of the pooler in bp not that long ago for a lidar project. It demonstrates the basics of the pooler.