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.
| Function | Returns | Purpose |
|---|
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) | void | Completes a deferred acquire: positions the instance and brings it into play. |
ReleaseActor(Actor) | bool | Stands 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) | void | Releases 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) | void | Cancels a pending delayed release. |
RequestActorQueued(ActorClass, Transform, NewOwner, NewInstigator) | int32 | Queues an acquire served across frames instead of immediately. Returns a request id. |
CancelQueuedRequest(RequestId) | bool | Drops a queued request before it is served. |
GetQueuedRequestCount() | int32 | How many requests are still outstanding. |
OnPooledActorReady | delegate | (AActor* Actor, int32 RequestId). Fires once per queued request, in order. Actor is null if the acquire failed. |
PrewarmPool(ActorClass, Count) | void | Spawns and parks instances up front. Refused with a warning before the world has begun play. |
DrainPool(ActorClass) | void | Destroys every free instance of a class. Checked-out instances are dropped from pool ownership. |
DrainAllPools() | void | As above, for every class. |
GetPoolStats(ActorClass) | FCrimsonObjectPoolStats | One class's counters. |
GetAllPoolStats() | TArray<FCrimsonObjectPoolStats> | Every pool, sorted by class name. |
IsPoolOwnedActor(Actor) | bool | Whether releasing this actor will recycle it rather than do nothing. |
IsBypassEnabled() | bool | Static. Reads the Crimson.ObjectPool.Bypass cvar. |
ICrimsonPoolable
Include Pooling/ICrimsonPoolable.h, and depend on CrimsonCommon. It lives there rather than in CrimsonObjectPool so that actors in other Crimson plugins can implement it - no Crimson plugin may reference a sibling.
| Member | Audience | Purpose |
|---|
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++ only | Optional. 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. |
FCrimsonOnPoolableReleaseRequested | C++ only | DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(..., AActor*, Actor). The delegate type returned above. |
UCrimsonObjectPoolSettings
Project Settings > Crimson > Crimson Object Pool. Config section CrimsonObjectPool.
| Setting | Default | Purpose |
|---|
DefaultCapacity | 32 | Free instances retained for a class with no override. |
DefaultGrowthPolicy | Grow | What happens when the free list is empty. |
bDestroyOnOverCapacityRelease | true | Destroy rather than pool a release that would exceed capacity. |
ClassOverrides | empty | TMap<TSoftClassPtr<AActor>, FCrimsonObjectPoolClassConfig>. Lookup walks up the class hierarchy. |
MaxSpawnsPerFrame | 2 | How many NEW actors a queued request may spawn per frame. Per frame, not per second - a hitch is a frame-cost problem. |
bBatchPooledAcquires | true | Serve queued requests that a warm pool can fill from its free list immediately, without spending the frame budget. |
PoolPressureWarningRatio | 0.9 | Warn once per class when live count reaches this fraction of capacity. 0 disables. |
bUseNetDormancyWhilePooled | true | Put replicated actors into DORM_DormantAll while parked. Leave on - see Concept: Replication and Recycling. |
Data types
| Type | Members |
|---|
FCrimsonObjectPoolClassConfig | Capacity, GrowthPolicy, PrewarmCount, bDestroyOnOverCapacityRelease |
FCrimsonObjectPoolStats | ActorClass, PooledCount, LiveCount, TotalCreated, SpawnsAvoided, HighWaterLive, Capacity |
ECrimsonObjectPoolGrowthPolicy | Grow, HardCap |
Console commands
| Command | Purpose |
|---|
Crimson.ObjectPool.Bypass 0|1 | 1 makes every acquire a real SpawnActor and every release a real Destroy. |
Crimson.ObjectPool.Dump | Prints per-class pooled / live / high-water / created / spawns-avoided / capacity. |
MCP tools
Gated behind Project Settings > Crimson > Crimson MCP > Enable Crimson MCP (requires an editor restart). All operate on the authoritative PIE world.
| Tool | Kind | Purpose |
|---|
CrimsonObjectPoolToolset.ListPools | read | Every pool with its full counters. |
CrimsonObjectPoolToolset.SetPoolBypass | act | Sets the bypass cvar. |
CrimsonObjectPoolToolset.DrainAllPools | act | Destroys every free instance in every pool. |