API Reference

UCrimsonObjectPoolSubsystem

A UWorldSubsystem, created for Game and PIE worlds only. Get it with UCrimsonObjectPoolSubsystem::Get(WorldContextObject) in C++ or Get Crimson Object Pool Subsystem in Blueprint.

FunctionReturnsPurpose
AcquireActor(ActorClass, Transform, NewOwner, NewInstigator)AActor*Hands out a live instance, recycling or spawning as needed. Null under HardCap exhaustion, or on a client for a replicated class.
AcquireActorDeferred(ActorClass, NewOwner, NewInstigator)AActor*Returns the instance still dormant so it can be configured before going live. Pair with FinishAcquiringActor.
FinishAcquiringActor(Actor, Transform)voidCompletes a deferred acquire: positions the instance and brings it into play.
ReleaseActor(Actor)boolStands the instance down and parks it, or destroys it if the free list is full. False if it was not pool-owned, already parked, or the caller was a client.
ReleaseActorAfter(Actor, Seconds)voidReleases after a delay. Cancels itself if the actor is released early or destroyed. Calling it again restarts the delay rather than queueing a second release.
CancelPendingRelease(Actor)voidCancels a pending delayed release.
RequestActorQueued(ActorClass, Transform, NewOwner, NewInstigator)int32Queues an acquire served across frames instead of immediately. Returns a request id.
CancelQueuedRequest(RequestId)boolDrops a queued request before it is served.
GetQueuedRequestCount()int32How many requests are still outstanding.
OnPooledActorReadydelegate(AActor* Actor, int32 RequestId). Fires once per queued request, in order. Actor is null if the acquire failed.
PrewarmPool(ActorClass, Count)voidSpawns and parks instances up front. Refused with a warning before the world has begun play.
DrainPool(ActorClass)voidDestroys every free instance of a class. Checked-out instances are dropped from pool ownership.
DrainAllPools()voidAs above, for every class.
GetPoolStats(ActorClass)FCrimsonObjectPoolStatsOne class's counters.
GetAllPoolStats()TArray<FCrimsonObjectPoolStats>Every pool, sorted by class name.
IsPoolOwnedActor(Actor)boolWhether releasing this actor will recycle it rather than do nothing.
IsBypassEnabled()boolStatic. Reads the Crimson.ObjectPool.Bypass cvar.

ICrimsonPoolable

Include Pooling/ICrimsonPoolable.h. Optional; an actor that implements nothing gets the pool's default handling.

MemberAudiencePurpose
OnAcquiredFromPool(const FTransform& Transform)Blueprint + C++Bring the instance back into play. Implementing the interface makes this the only reactivation that happens.
OnReleasedToPool()Blueprint + C++Stand the instance down. Called while it is still fully active, before the pool applies dormancy.
GetPoolReleaseDelegate()C++ onlyOptional. Return a delegate you broadcast when finished and the pool reclaims the actor automatically. Not a UFUNCTION - a Blueprint cannot hand out a delegate reference, and should call Release Actor instead.
FCrimsonOnPoolableReleaseRequestedC++ onlyDECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(..., AActor*, Actor). The delegate type returned above.

ICrimsonPoolableAdapter

Native only. Include Pooling/CrimsonPoolableAdapter.h. Supplies the ICrimsonPoolable hooks from outside a class you cannot modify. See How-To: Make an Actor Poolable.

MemberPurpose
OnAcquiredFromPool(AActor* Actor, const FTransform& Transform)Bring the instance back into play. Required.
OnReleasedToPool(AActor* Actor)Stand the instance down. Required.
BindReleaseRequest(AActor* Actor, UCrimsonObjectPoolSubsystem* Pool)Optional. Called once per pooled instance: arrange for Pool->ReleaseActor(Actor) to run when the actor is finished, typically by binding its own delegate with Pool as the weak owner.
UnbindReleaseRequest(AActor* Actor, UCrimsonObjectPoolSubsystem* Pool)Optional. Undo BindReleaseRequest when the instance leaves pool ownership.
Registry function (namespace CrimsonObjectPool)Purpose
RegisterPoolableAdapter(TSubclassOf<AActor> ActorClass, TSharedRef<ICrimsonPoolableAdapter> Adapter)Registers the adapter for the class and its subclasses, replacing any previous adapter for that exact class.
UnregisterPoolableAdapter(TSubclassOf<AActor> ActorClass)Removes the adapter registered for exactly that class.
FindPoolableAdapter(const UClass* Class)The class's own adapter, else the nearest registered superclass's, else null.

UCrimsonObjectPoolSettings

Project Settings > Crimson > Crimson Object Pool. Config section CrimsonObjectPool.

SettingDefaultPurpose
DefaultCapacity32Free instances retained for a class with no override.
DefaultGrowthPolicyGrowWhat happens when the free list is empty.
bDestroyOnOverCapacityReleasetrueDestroy rather than pool a release that would exceed capacity.
ClassOverridesemptyTMap<TSoftClassPtr<AActor>, FCrimsonObjectPoolClassConfig>. Lookup walks up the class hierarchy.
MaxSpawnsPerFrame2How many NEW actors a queued request may spawn per frame. Per frame, not per second - a hitch is a frame-cost problem.
bBatchPooledAcquirestrueServe queued requests that a warm pool can fill from its free list immediately, without spending the frame budget.
PoolPressureWarningRatio0.9Warn once per class when live count reaches this fraction of capacity. 0 disables.
bUseNetDormancyWhilePooledtruePut replicated actors into DORM_DormantAll while parked. Leave on - see Concept: Replication and Recycling.

Data types

TypeMembers
FCrimsonObjectPoolClassConfigCapacity, GrowthPolicy, PrewarmCount, bDestroyOnOverCapacityRelease
FCrimsonObjectPoolStatsActorClass, PooledCount, LiveCount, TotalCreated, SpawnsAvoided, HighWaterLive, Capacity
ECrimsonObjectPoolGrowthPolicyGrow, HardCap

Console commands

CommandPurpose
Crimson.ObjectPool.Bypass 0|11 makes every acquire a real SpawnActor and every release a real Destroy.
Crimson.ObjectPool.DumpPrints per-class pooled / live / high-water / created / spawns-avoided / capacity.

CrimsonCore types (for orientation only)

(CrimsonCore - requires all Crimson plugins) These ship in CrimsonCore, which is free to download but compiles only with all Crimson plugins installed. They are not part of this plugin; the self-built equivalent is an adapter or interface of your own (How-To: Make an Actor Poolable).

TypeWhat it does
UCrimsonCoreProjectilePoolingSubsystemEngine subsystem that registers an ICrimsonPoolableAdapter for the CrimsonHitDetection projectile class and its subclasses.
UCrimsonAbilityTask_LaunchPooledProjectile, UCrimsonAbilityTask_LaunchPooledProjectileVolleyAbility task nodes that launch projectiles through the pool: Crimson Launch Pooled Projectile, Crimson Launch Pooled Projectile Volley, Crimson Launch Pooled Projectile Pattern.