Skip to main content

Actor Pool Settings

Base:
UStruct
Type:
FNActorPoolSettings
Header File:
NexusActorPools/Public/NActorPoolSettings.h

A Blueprint-compatible struct that defines configuration parameters for managing object pooling inside a FNActorPool. This struct provides comprehensive settings to control how actors are created, managed, and recycled.

Highlights​

  • Pool Size Management: Controls minimum (default: 10) and maximum (default: 100) actor counts in the pool.
  • Performance Optimization: Configurable objects-per-tick creation limit and pool expansion policies.
  • Flexible Strategies: Supports different pooling strategies through ENActorPoolStrategy.
  • Spawn Behavior Control: Options for deferred construction, finish spawning behavior, and location management.
  • Return Mechanics: Configurable return location and movement behavior for recycled AActors.

Configuration Options​

SettingTypeDescriptionDefault
MinimumActorCountint32When the FNActorPool is being filled during creation, what is the number of prewarmed AActors that should be created, either synchronously or divided across a number of frames.10
MaximumActorCountint32The number of pooled AActors that a pool can use/have. This is tied more to the Strategy being used for what happens when the pool has to create new AActors when the pool has no AActors available to Spawn()/Get().100
CreateObjectsPerTickint32Throttles the number of AActors that can be created per Tick. This can be useful to spread the cost of warming a pool up across multiple frames (-1 for unlimited).-1
StrategyENActorPoolStrategyDetermines the approach taken when the pool does not have any AActor remaining in the "In" pool, and needs to create one (or reuse).APS_Create
FlagsENActorPoolFlagsThe behavioral flags to evaluate when doing operations with this pool.APF_ReturnToStorageLocation, APF_DeferConstruction, APF_ShouldFinishSpawning, APF_ServerOnly
DefaultTransformFTransformThe default applied transform when creating an AActor, with the location component being used as the storage location when an AActor is returned to the pool, and the scale applied when spawned.Translation(0,0,0) Rotator(0,0,0) Scale(1,1,1)

Creation Strategies​

NativeDisplayDescription
APS_CreateCreateCreate AActor as needed.
APS_CreateLimitedCreate Till CapCreate AActor until MaximumActorCount is reached and stop returning a nullptr in such cases.
APS_CreateRecycleFirstCreate Till Cap, Recycle FirstCreate AActor until MaximumActorCount is reached, any requests beyond provide the oldest already spawned AActor in a FIFO behavior.
APS_CreateRecycleLastCreate Till Cap, Recycle LastCreate AActor until MaximumActorCount is reached, any requests beyond provide the newest spawned AActor in a LIFO behavior.
APS_FixedFixed AvailabiltyDeploys AActor as needed from fixed pools, exceeding availability results in a nullptr being returned.
APS_FixedRecycleFirstFixed Availabilty, Recycle FirstDeploys AActor as needed from fixed pools, exceeding availability will return the oldest already spawned AActor in a FIFO behavior.
APS_FixedRecycleLastFixed Availabilty, Recycle LastDeploys AActor as needed from fixed pools, exceeding availability will return the newest already spawned AActor in a LIFO behavior.

Flags​

NativeDisplayDescription
APF_SweepBeforeSettingLocationSweep Before Setting LocationShould a sweep be done when setting the location of an AActor being spawned?
APF_ReturnToStorageLocationReturn To Storage LocationShould the AActor being returned to the pool be moved to a storage location?
APF_DeferConstructionDefer ConstructionControls whether AActor construction is deferred when creating new AActors; allowing for additional calls to be made to the INActorPoolItem::OnDeferredConstruction() before calling the AActors FinishSpawning().
APF_ShouldFinishSpawningShould Finish SpawningManages FinishSpawning() calls for non-INActorPoolItem AActors.
APF_ServerOnlyServer OnlySafely ensure all actions only actually occur on world authority (server), transparently making the pool networked.
APF_BroadcastDestroyBroadcast DestroyBroadcast destroy event on the Actor through the operational change state delegate.
APF_SetNetDormancySet Net DormancyShould an Actor's network dormancy be updated based on state?

Project-Wide Defaults​

From the Edit > Project Settings window, find the NEXUS section; there should be a Actor Pools option which will display the default settings used when an AActor is requested from an unitialized pool.

NActorPools