Skip to main content

Actor Pool Spawner Component

Custom Icon
Base:
UActorComponent
Type:
UNActorPoolSpawnerComponent
Header File:
NexusActorPools/Public/NActorPoolSpawnerComponent.h

A fundamental spawning component which will interact with the UNActorPoolSubsystem to periodically spawn defined AActors in predefined distributions (shapes).

UNActorPoolSpawnerComponent

warning

This is a rudimentary example of how to spawn things; it has some use cases in a shipping game, but should not be the primary spawing source.

Component Settings​

SettingTypeDescriptionDefault
Spawning EnabledboolIs the component going to Spawn enemies when ticked?true
Server AuthoritativeboolShould the spawner only spawn on servers, ignoring itself on client-only.true
Spawn RatefloatThe rate at which things should be spawned.0.5f
OffsetFVectorOffset from the component location to treat as the origin when calculating a position to spawn an AActor.(0,0,0)
DistributionENActorPoolSpawnerDistributionThe specific distribution-shape to use when selecting a point/location to spawn an AActor at.Point
Distrubtion RangeFVectorThe axis-based ranges to use when outlining the shapes size, and or any sort of exclusionary range.(1.f,20.f,20.f)
Spline Level ReferenceFComponentReferenceWhen Spline is selected as Distribution, this option will be visible to select a SplineComponent in the current level.nullptr
Countint32The number of items to spawn at any given spawn event.1
Randomize SeedboolShould a random seed be selected on BeginPlay() for this component?false
Seedint32The seed used for all random selection related to this component.0
TemplatesFNActorPoolSpawnerTemplate[]A weighted collection of AActors and their default FNActorPoolSettings for usage with the component.Empty

Distribution Types​

NativeDisplayDescription
PointPointAlways spawn at the given component's location + Offset.
RadiusRadiusSelects a point at the given component's location + Offset, with a minimum radius of DistributionRange.X and a maximum radius of DistributionRange.Y on the horizontal axis.
SphereSphereSelects a point at the given component's location + Offset, in a sphere, with a minimum radius of DistributionRange.X and a maximum radius of DistributionRange.Y.
BoxBoxSelects a point at the given component's location + Offset, in an axis-aligned box, using the DistributionRange for size.
SplineSplineSelects a point along the target SplineLevelReference.

UFunctions​

The methods exposted to Blueprint.

Spawn​

/**
* Initiate a spawn call for the component, ignoring any timers.
* @param bIgnoreSpawningFlag Should the internal spawning flag state be ignored?
*/
void Spawn(bool bIgnoreSpawningFlag = false);

Disable Spawning​

/**
* Disables the component's internal flag to stop any spawning from occuring.
*/
void DisableSpawning()

Enable Spawning​

/**
* Enables the component's internal flag to allow spawning to occur (on by default).
*/
void EnableSpawning()