Zero-allocation actor pooling for Unreal Engine 5 via a World Subsystem.
Pre-spawn actors at level start, recycle them at runtime. No per-frame memory allocation, no GC spikes.
- Clone or download this repo into your project's
Plugins/folder:cd YourProject/Plugins git clone https://github.com/NicholasGrigoriev/ActorPoolPlugin.git - Regenerate project files and build.
- Create a Blueprint subclass of
ActorsPoolWorldSubSystem(the C++ class is Abstract). - In the Blueprint's Class Defaults, assign a Pool Config data asset (
ActorsPoolWorldConfig) that maps actor classes to pool sizes. - Register the Blueprint in Project Settings → Asset Manager → Primary Asset Types to Scan:
- PrimaryAssetType:
UActorsPoolWorldSubSystem - AssetBaseClass: your Blueprint class
- bHasBlueprintClasses: True
- SpecificAssets: path to your Blueprint
- PrimaryAssetType:
- Use the pool in code or Blueprint:
SpawnActorFromPool— get an actor from the poolReturnActorToPool— return it when done- Optionally implement
IObjectPoolInterfaceon your actor for spawn/despawn callbacks
- On level start, the subsystem reads the config and pre-spawns all actors (hidden, collision off, tick off)
SpawnActorFromPoolpops an actor from the inactive list, teleports it, and activates itReturnActorToPoolhides it and puts it back- If the pool is empty, optionally falls back to regular spawning
MIT