[Plugin] Object Pool Component

OBJECT POOL PLUGIN(Object Pool Plugin in Code Plugins - UE Marketplace)


Install Plugin:

Be sure that you have the plugin installed and ready to use for your Unreal Engine:

Pooled Classes:

To use the pooling system you have to create (or reparent existing) Actor classes to be compatible with **Pool Component **containers.
There are three base classes for this purpose, you can create a Pooled Actor class, a Pooled Pawn class, or a Pooled Character class:

Pool Events:

The reason for re-parenting to, or creating new of, these special classes is for C++ system perform complex memory management outside the “World of Blueprints”. With your classes being children of these core classes the plugin can manage them without really having to know which class your Actor exactly is.
It’s the Pool Component that does this managed in C++ for you, automatically. It tricks Unreal to reset and recycle an existing allocated Actor instead of creating new memory for yet another Actor to do what our existing Actor already does. The results are massive performance improvements under circumstances where your game must frequently spawn Actors of similar or equal classes all the time. Because “Begin Play” and “End Play” can only execute on newly created Actors or Actors that are being destroyed, your Pooled Actor classes also contains special events called “On Pool Begin Play” and “On Pool End Play”. These special events will execute in your Blueprints whenever an instance is activated by the Pool Component’s container and whenever it is deactivated:

From those events you can execute pretty much anything that you would need to execute on “Begin Play”, very convenient.

Pool Components:

There’s four different types of Pool Components provided by the plugin. One deals with generic Pooled Actor classes, another one for Pooled Pawn classes, another one is for managing Pooled Characters, and the last one is a Shared Pool for managing several classes of Pooled Actors all spawned by the same Pool Component.

There’s a VERY IMPORTANT rule you have to keep in mind when dealing with Pool Components!
This rule is: Do NOT add Pool Components to be a member of Pooled Actors that are spawned by that same Pool Component class.

Infinite loop happens if you do that. Don’t do it.

Pool Component’s Properties:

Pool Components expose to you three basic properties for generating a Pool of Actors for you.
Template Class: Select the base class of Actors you want Pool Component to create and manage.
Pool Size: How many pre-allocated Pooled Actors you need? you can set how many you want here.
Auto Initialize: On Begin Play the Pool Component will spawn and keep in memory instances of the Template Class.

Very simple, all the rest is done by the Pool Component in C++ world.

Pool Component’s Spawn Functions:

Once you have your Pooled Actor classes, Pool Components in place, and have set the Template Class correctly, the Blueprint housing the Pool Component can get an easy reference to it and call either “Spawn Actor from Pool”, “Spawn Pawn from Pool”, or “Spawn Character from Pool” nodes. Depending on which kind of Pool Component you have set:

IMPORTANT: Since v1.9.0, you have to pick a target class on both the Pool Component (Template Class) and on the Spawn from Pool nodes.
This is the way it is to fix a problem regarding “Exposed on Spawn” properties not adding pins to the Spawn from Pool nodes.


When it comes to projectile movement, you cannot pool the default movement component of Unreal Engine.
That component is made to move Actors that have just being created and once it stops you cannot recycle the functions. Making you feel forced to spawn a new Actor every time your weapon shoot a new bullet. So, instead of using default projectile movement component on your Pooled Actors, bullet actors, you have to use a custom movement component provided by the plugin: a Pooled Projectile Component:

Alternatively, for fancy effects, the v1.9.0 plugin also provides a Spline Projectile Component that can be used to travel bullets along a spline path:


With this component you can simulate a bullet without the Pooled Actor using any actual physics simulations, the projectile can have collisions and simulation disabled. The collision detection is done by the Spline Projectile Component in C++ using sphere traces:

To use a Spline Projectile Component you must pass into each instance of your Pooled Actors in your Pool Component to use a Spline Component that you have created. The Spline Component’s points will provide to the projectile the path and orientation to follow when the bullet is shot. Here’s is how you can pass into instances of projectiles an Spline Component to use:

And then you can use Spawn Actor from Pool nodes as usual, once activated a bullet Actor is going to follow the Spline you provided:


Dealing with Niagara Particle Components on Pooled Actors:

You have to activate “Force Solo” option on your Niagara Component.
Niagara will disable GPU pooling and allow you to do CPU pooling of the component:

ok, i don’t know C++, I’ll wait for your plugin

This is actually very useful for a lot of things, definitely worth $10 I’d say. :slight_smile:

Hope it gets put on the marketplace ASAP!

Good job :slight_smile:

I have just updated original post, with Marketplace release date, and the tutorial on how to use the plugin :slight_smile:

Awww, I really like “quality of life” plugins like this. Could you please update us when it’s ready to be thrown money at? :smiley:

Marketplace released this today:

Thank you!

Essential plugin but having crash-issue with 4.14. Seems like if the pool have some destroed actors, then the editor crashes when “empty object pool”-node is used, the related blueprint (that have the pool) is destroyed or play in viewport session is ended.

Thanks, I will check this right now.
Just keep in mind that pooled objects are not supposed to be destroyed (destroy the pool owner instead), but it shouldn’t crash because of that, I will see where the mistake is.



Thank you for finding this issue;
I have found the crash reason, I’ve fixed it and will submit to Epic as soon as I can.

The thing is, I forgot about one thing: to check if any of Pooled Actors are marked by the engine as Pending Kill before I tell the Pool Component to be empty.
The result is that once you destroy a pooled actor, it is not immediately gone… It is marked as pending kill until GC is able to collect, but there’s a pointer in the Pool holding reference to the destroyed Actor and once you use the ‘Empty Pool’ in this case you are actually calling Destroy() function 3x on an Actor that is not valid anymore.
I just had to check if the pooled Actors are valid at low level, just one line of code inside the Empty Pool function.

Great to hear :), thanks for the instant response. Cant wait to try the upcoming update.

Was using the pool for bullets. Tried to prevent those getting destroyed, but seems those ended up to z world removal.

I’ve sent the files to Epic already; I have to sit and wait now.


Fix is already on Marketplace.

Does this plugin support c++ Actor ? And how to pool the particles?

Hi Bruno! Great plugin!

Quick question: To get an actor spawned from the pool to tick i have to enable ticks in the On Pool Begin Play? It was the only way i could get ticks to work. (and probably a stupid follow up question; should i then disable ticks before returning it to the pool? :confused:)

I’ll definitely be buying this!! Very excited for the Pooled Characters and pawns!

Thanks, Character support will come soon; I just hsve to deliver paid work first :s

Yes, you can use any C++ Actor class with this as well as Blueprints.
If the particle is attached to a pooled Actor, you can use the “Pool Begin Play” and “Pool End Play” events on that Actor, to activate/deactivate particle effects.

Looks quite useful :slight_smile:

Will definitely buy it when it supports characters!

What happens if I have to spawn more actors then the pool size? will the pool size increase dynamically?

Doing that will defeat the concept of object pool.
There’s an option in Project Settings to enable this, but doing so you will fire SpawnActor<>() function and break the “pooling” cycle; for this reason I have not invested too much on this functionality, depending on what you do it will not work as expected.

This second option, it’s left disabled by default:

Thanks Bruno, I was just wondering if you implemented something for this case.
I wondered because I can not tell if a pool of e.g. 1k is enough for projectiles in all cases. Players would be upset if their headshot is projectile #1001 and won’t get spawned because the pool is full :slight_smile: That’s why I asked.