The primary pooling solution, accessible by any entity part of the current world, consisting of two distinct pool types:
Global Pool - Intended to be used as a way to pool actors that need to be available in all levels unless specified otherwise by the user. For example, in a multiplayer shooter, you may want to pool your projectiles in this pool. Go to SmartPoolDevSettings to find out more.
Local Pool - Intended to be used as a way to pool actors that are only available in the level in which they were created in, hence each level can pool different actors. For example, in a dungeon crawler, you may want to use this pool to store a skeleton enemy in one level and a goblin enemy in another. Go to SmartPoolWorldSettings to find out more.
Actors pooled by the PoolSubsystem follow the lifetime of the world in which they are created in, getting instantiated in OnWorldBeginPlay, unless specified otherwise, and being destroyed along with other actors during world teardown, unless having already been cleaned up by the user manually at an earlier stage.
Keep in mind all entries for both pools are compared with one another and any duplicates found, even if they are in different pools, will be ignored.
Most user interactions with this WorldSubsystem are achieved via the SmartPoolLibrary. The only time that users will need to access the system directly is when they wish to bind to one of its delegates (Events).
This section will cover and briefly explain the full range of delegates held by the system available to Blueprint & C++ users. Go to SmartPoolDelegates to find out more.
FOnPoolLoaded OnWorldPoolLoaded;
Broadcast twice within this system, once when the global pool is loaded and once when the local pool is loaded. Both broadcasts of this delegate happen very early on in world creation, therefore binding in most places may already be too late.
FOnPoolExpanded OnWorldPoolExpanded;
Broadcast when a new actor is created due to insufficient pooled actor availability. Applies to both the Global & Local pools. Does not occur during initial actor pooling.
FOnPoolDeactivated OnWorldPoolDeactivated;
Broadcast when either pool is fully deactivated (All actors part of the pool are deactivated). Can be achieved using the ReleasePool method part of the SmartPoolLibrary.
FOnPoolDestroyed OnWorldPoolDestroyed;
Broadcast when either pool is fully destroyed (All actors part of the pool are destroyed). Can be achieved using the ReleasePool method part of the SmartPoolLibrary.
FOnActorsDeactivated OnWorldActorsDeactivated;
Broadcast when all pooled actors of a specific type are deactivated. Can be achieved using the ReleaseActorsOfType method part of the SmartPoolLibrary.
FOnActorsDestroyed OnWorldActorsDestroyed;
Broadcast when all pooled actors of a specific type are destroyed. Can be achieved using the ReleaseActorsOfType method part of the SmartPoolLibrary.
FOnPooledActorActivated OnWorldActorActivated;
Broadcast when a pooled actor is activated. Can be achieved using the range of SpawnActor methods part of the SmartPoolLibrary.Â
FOnPooledActorDeactivated OnWorldActorDeactivated;
Broadcast when a pooled actor is deactivated. Can be achieved using the DeactivatePooledActor method part of the SmartPoolLibrary.
FOnPooledActorDestroyed OnWorldActorDestroyed;
Broadcast when a pooled actor is destroyed. Can be achieved using the DestroyPooledActor method part of the SmartPoolLibrary.
The secondary pooling solution, intended to only be accessed by the component's owning actor when it comes to pool management. For example, in a zombie shooter, you may want to add an ActorPoolComponent to your player and pool projectiles on it, since only the player needs projectiles and zombies do not.
The idea behind the ActorPoolComponent is that it grants exclusive access to its actor pools to the actor the component belongs to. You can still query the component using its utility methods outside of this scope, however you should not call functions that change the components actor pools, since this would break the intended use of the component.
Actors pooled by the ActorPoolComponent follow the lifetime of the ActorPoolComponent, getting instantiated in BeginPlay, unless specified otherwise, and being destroyed when the ActorPoolComponent or owning actor are destroyed, unless having already been cleaned up by the user manually at an earlier stage.
Some pre-existing actor pooling solutions admit to suffering to an infinite actor spawning loop if the actors they are pooling pool their own actors and so on. This is not an issue with this plugin as actors that contain ActorPoolComponents are automatically disregarded when being pooled inside of an ActorPoolComponent.
All pool manipulation methods, utility methods and delegates are close to identical to those found in the SmartPoolLibrary and PoolSubsystem, therefore their explanations will not be repeated here.
The only differences are the following:
Unlike the PoolSubsystem, all user facing methods are found directly on the ActorPoolComponent, this is done in order to further aid in the exclusivity between the owning actor and actor pools, as well as making it easier to distinguish between PoolSubsystem calls via SmartPoolLibrary and ActorPoolComponent calls.
Delegates within the component are prefixed with Actor or PooledActor instead of World to distinguish them from their PoolSubsystem counterparts and prevent naming conflicts with Unreal's own delegates.
This section will cover and briefly explain the full range of delegates held by the system available to Blueprint & C++ users. Go to SmartPoolDelegates to find out more.
FOnPoolLoaded OnActorPoolLoaded;
Broadcast when the pool is loaded.
FOnPoolExpanded OnActorPoolExpanded;
Broadcast when a new actor is created due to insufficient pooled actor availability. Does not occur during initial actor pooling.
FOnPoolDeactivated OnActorPoolDeactivated;
Broadcast when the pool is fully deactivated (All actors part of the pool are deactivated). Can be achieved using the ReleasePool method.
FOnPoolDestroyed OnActorPoolDestroyed;
Broadcast when the pool is fully destroyed (All actors part of the pool are destroyed). Can be achieved using the ReleasePool method.
FOnActorsDeactivated OnActorsDeactivated;
Broadcast when all pooled actors of a specific type are deactivated. Can be achieved using the ReleaseActorsOfType method.
FOnActorsDestroyed OnActorsDestroyed;
Broadcast when all pooled actors of a specific type are destroyed. Can be achieved using the ReleaseActorsOfType method.
FOnPooledActorActivated OnPooledActorActivated;
Broadcast when a pooled actor is activated. Can be achieved using the range of SpawnActor methods.Â
FOnPooledActorDeactivated OnPooledActorDeactivated;
Broadcast when a pooled actor is deactivated. Can be achieved using the DeactivatePooledActor method.
FOnPooledActorDestroyed OnPooledActorDestroyed;
Broadcast when a pooled actor is destroyed. Can be achieved using the DestroyPooledActor method.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
TSoftObjectPtr<UPoolProfile> ActorPoolProfile;
Allows you to assign the PoolProfile that you want the component to use to initialise its actor pools. Assigned via the Details Panel.
Convenience wrapper for Blueprint & C++ users who are trying to access the PoolSubsystem. Prevents the need for users to manually retrieve the PoolSubsystem before accessing its pool manipulation methods, reducing bloat in user implementations.
Batch methods like ReleasePool or ReleaseActorsOfType that affect a large number of pooled actors do not cause actor decaying as they are meant for cleanup rather than gameplay changes.
This section will cover and explain in detail the full range of pool manipulation functionalities provided by this library.
UFUNCTION(BlueprintCallable, Category = "SmartPool|Core", meta = (...))
static void ReleasePool(UObject* WorldContextObject, const EPoolType PoolType, const EPoolReleaseMode PoolReleaseMode);
Used to deactivate/destroy all actors in the specified pool.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
PoolType - The type of pool you want to affect. Go to PoolType to find out more.
PoolReleaseMode - The operation you want to perform on the specified pool. Go to PoolReleaseMode to find out more.
UFUNCTION(BlueprintCallable, Category = "SmartPool|Core", meta = (...))
static void ReleaseActorsOfType(UObject* WorldContextObject, const TSubclassOf<AActor> ActorClass, const EPoolReleaseMode PoolReleaseMode);
Used to deactivate/destroy all actors of the specified type. Searches both pools for the provided actor type.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
ActorClass - The type of actor you want to affect.
PoolReleaseMode - The operation you want to perform on the specified actor type.
UFUNCTION(BlueprintCallable, Category = "SmartPool|Core", meta = (...))
static void DeactivatePooledActor(AActor* Actor);
Used to deactivate the specified pooled actor. Searches both pools for the provided pooled actor.Â
Actor - The pooled actor you want to deactivate.
UFUNCTION(BlueprintCallable, Category = "SmartPool|Core", meta = (...))
static void DestroyPooledActor(AActor* Actor);
Used to destroy the specified pooled actor. Searches both pools for the provided pooled actor.Â
Actor - The pooled actor you want to destroy.
template<class T>
static T* SpawnPooledActor(UObject* WorldContextObject, UClass* ActorClass, const FTransform& SpawnTransform,
                           const FActorSpawnParameters& SpawnParameters = FActorSpawnParameters());
Used to spawn a pooled actor specified by the actor type. C++ only function. This method has several overloads, each aiming to replicate Unreal's own set of SpawnActor methods to grant users the same level of control when spawning pooled actors.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved.
ActorClass - The type of actor you want to look for. Searches both pools for the provided actor type.
SpawnTransform - The location, rotation and scale you want to apply to your spawned pooled actor.
SpawnParameters - Additional data (Owner, Instigator...) you want to apply to your spawned pooled actor.
Returns a pointer of the actor type specified by the template to the spawned pooled actor or nullptr if a pooled actor couldn't be spawned.
UFUNCTION(BlueprintCallable, Category = "SmartPool|Core", DisplayName = "Spawn Pooled Actor", meta = (...))
static AActor* K2_SpawnPooledActor(UObject* WorldContextObject, const TSubclassOf<AActor> ActorClass, const FTransform& SpawnTransform,
                                   const ESpawnActorCollisionHandlingMethod CollisionHandlingMethod,
                                   const ESpawnActorScaleMethod TransformScaleMethod, AActor* Owner, APawn* Instigator);
Used to spawn a pooled actor specified by the actor type. Intended to be used in Blueprint, can also be used in C++.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
ActorClass - The type of actor you want to look for. Searches both pools for the provided actor type.
SpawnTransform - The location, rotation and scale you want to apply to your spawned pooled actor.
CollisionHandlingMethod - The way in which to handle the spawning of a pooled actor in cases where the chosen location causes it to penetrate blocking collisions.
TransformScaleMethod - The way in which the provided scale and the pooled actor's default object scale interact.
Owner - Sets the spawned pooled actor's owner to the provided owner.
Instigator - Sets the spawned pooled actor's instigator to the provided instigator.
Returns a pointer of the specified actor type to the spawned pooled actor or nullptr if a pooled actor couldn't be spawned.
This section will cover and explain in detail the full range of utility functionalities provided by this library.
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static bool ContainsActorPoolComponent(const TSubclassOf<AActor> ActorClass);
Lets you know if the provided actor type contains an ActorPoolComponent. Works in situations where the component was added via C++ (Constructor) and via blueprint (Component Panel).
ActorClass - The actor type you want to query.
Returns true if the actor type contains an ActorPoolComponent; otherwise, returns false if no ActorPoolComponent was found or if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static bool IsActorPooled(const AActor* Actor);
Lets you know if the provided actor is being pooled by the PoolSubsystem.
Actor - The actor you want to query.
Returns true if the actor is pooled; otherwise, returns false if not pooled, not found or if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static bool IsActorClassPooled(const UObject* WorldContextObject, const TSubclassOf<AActor> ActorClass);
Lets you know if the provided actor type is being pooled by the PoolSubsystem.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
ActorClass - The actor type you want to query.
Returns true if the actor type is pooled; otherwise, returns false if not pooled, not found or if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static bool IsActorActive(const AActor* Actor);
Lets you know if the provided actor is active (In-use), in the PoolSubsystem.
Actor - The actor you want to query.
Returns true if the actor is active; otherwise, returns false if not active, not found or if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static bool IsActorDecaying(const AActor* Actor);
Lets you know if the provided actor is decaying, in the PoolSubsystem.
Actor - The actor you want to query.
Returns true if the actor is decaying; otherwise, returns false if not decaying, not found or if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static int32 GetPoolSize(const UObject* WorldContextObject, const TSubclassOf<AActor> ActorClass);
Lets you know how many actors of the specified type are being pooled by the PoolSubsystem.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
ActorClass - The actor type you want to query.
Returns the number of actors currently being pooled; otherwise, returns -1 if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static int32 GetActiveCount(const UObject* WorldContextObject, const TSubclassOf<AActor> ActorClass);
Lets you know how many actors of the specified type are active (In-use) in the PoolSubsystem.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
ActorClass - The actor type you want to query.
Returns the number of currently active (In-use) actors; otherwise, returns -1 if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static int32 GetInactiveCount(const UObject* WorldContextObject, const TSubclassOf<AActor> ActorClass);
Lets you know how many actors of the specified type are inactive (Available) in the PoolSubsystem.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
ActorClass - The actor type you want to query.
Returns the number of currently inactive (Available) actors; otherwise, returns -1 if the function ran into issues (See LogSmartPool logs in Output Log).
UFUNCTION(BlueprintPure, Category = "SmartPool|Utilities", meta = (...))
static int32 GetDecayingCount(const UObject* WorldContextObject, const TSubclassOf<AActor> ActorClass);
Lets you know how many actors of the specified type are decaying in the PoolSubsystem.
WorldContextObject - The object from which a safe reference to UWorld can be retrieved. Automatically passed in when calling from Blueprint.
ActorClass - The actor type you want to query.
Returns the number of currently decaying actors; otherwise, returns -1 if the function ran into issues (See LogSmartPool logs in Output Log).
Container for default Activation & Deactivation logic of pooled actors.
Things to note:
Default Activation/Deactivation logic occurs naturally on actors who haven't inherited/implemented (C++/Blueprint) the Poolable interface.
For blueprint-only actors who implement Poolable without a C++ base that inherits the interface, you must do the following if you wish to use default Activation/Deactivation:
Implement the OnActivate & OnDeactivate methods.
Find the OnDefaultActivateActor & OnDefaultDeactivateActor nodes and attach them to the corresponding implementations.
For users that wish to use default Activation/Deactivation logic in multiplayer scenarios, you must ensure your actor derives from PooledActor.
UFUNCTION(BlueprintCallable, Category = "SmartPool|Defaults", meta = (...))
static void OnDefaultActivateActor(AActor* Actor);
Default activation behaviour consists of enabling visibility, collisions and ticking. Does not track initial actor state.
Actor - The actor you want to perform default activation logic on. Should be called from the actor you are passing in. Automatically passed in when calling from Blueprint.
UFUNCTION(BlueprintCallable, Category = "SmartPool|Defaults", meta = (...))
static void OnDefaultDeactivateActor(AActor* Actor);
Default deactivation behaviour consists of disabling visibility, collision and ticking.
Actor - The actor you want to perform default deactivation logic on. Should be called from the actor you are passing in. Automatically passed in when calling from Blueprint.
Primarily used internally to enabling the writing of external analysis text files for later viewing and analysing. Exposed to users purely as an added bonuses in case they wish to use it or use the implementation as a reference point when writing their own external file writing utilities.
UFUNCTION(BlueprintCallable, Category = "SmartPool|ExternalFileHelpers", meta = (...))
static bool WriteStringToFile(const FString& FilePath, const FString& StringToWrite);
Writes the provided string to the provided path.
FilePath - The location where the file should be written to.
StringToWrite - The text that should be written into the file.
Returns true upon success.
UPrimaryDataAsset used to hold all data regarding actor pooling. Using assets to represent various pooling configurations, as opposed to directly creating variables in systems where pooling data is required, gives the following benefits:Â
It gives you the ability to create any number of profiles you require, each with unique pooling configurations.
It allows for a much simpler and quicker workflow as you can easily interchange profiles with one another without having to edit their underlying pooling data.
It's easier to organize profiles within your contents folder; this way you can maintain a clean and simple project structure that's easy to navigate and build upon.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
FString PoolProfileName;
Used as a customizable type of identification. Primarily used in the outliner folder that will house the contents of the profile, as well as further identification in editor tools and external analysis files.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
TArray<FPoolProfileEntry> PoolProfileEntries;
Represents the core underlying information regarding actor pooling. Duplicate entries are ignored during profile processing in pooling solutions.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", AdvancedDisplay, meta = (...))
bool bPersistRecommendedValues;
When enabled, the assets actor pooling information is automatically adjusted using recommended values gathered during gameplay. Nevertheless, it is still advised to adjust the values manually, however the option is there if desired. The times when these changes occur differs based on the pooling system that the profile is currently a part of:
PoolSubsystem - Saving occurs during OnWorldBeginTearDown.
ActorPoolComponent - Saving occurs during component EndPlay.
Holds all data regarding actor pooling for the specified actor type.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
TSubclassOf<AActor> ActorClass;
The type of actor to be pooled.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
bool bPrewarm;
The states this value can take:
True - Actors are pre-cooked using InitialPoolSize during each pooling solutions BeginPlay logic.Â
False - Actors are only added on demand (Lazy Growth) and reused as usual after.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
int32 InitialPoolSize;
The number of actors that will be pooled at the start. Value cannot be less than 0. Ignored when bPrewarm is false.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
int32 MaxPoolSize;
The maximum number of actors that can be pooled. Value cannot be less than 0 or InitialPoolSize.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
bool bSpawnableAtRuntime;
Whether additional actors can be created at runtime if there are no more available pooled actors. Value cannot be false when bPrewarm is false.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
bool bCanDecay;
Whether pooled actors that go inactive can decay and ultimately free themselves from memory. Decaying only occurs on pooled actors that were manually deactivated by the user.
UPROPERTY(EditDefaultsOnly, Category = "SmartPool", meta = (...))
float DecayTime;
The time in seconds it takes for an inactive actor to decay and be freed from memory. Value cannot be less than 0. Ignored when bCanDecay is false.
Allows users to turn any AActor derived class into a pooled entity capable of its own custom Activation & Deactivation logic.
Users should not rely on the following Unreal methods when it comes to pooled actors:
BeginPlay - Should not hold any gameplay logic as pooled actors are created once and reused, begin plays are not re-run upon reuse.
EndPlay - Should not hold any gameplay logic as pooled actors are reused, hence not destroyed, unless actors decay, level changes occur or explicit pool cleanup is carried out by the user.
UFUNCTION(BlueprintNativeEvent, Category = "SmartPool", meta = (...))
void OnActivate();
Intended to hold user defined activation logic and any gameplay related logic that would otherwise go into BeginPlay. Implementable via Blueprint & C++. Has a default implementation, go to PoolableHelpers to find out more.
UFUNCTION(BlueprintNativeEvent, Category = "SmartPool", meta = (...))
void OnDeactivate();
Intended to hold user defined deactivation logic and any gameplay related logic that would otherwise go into EndPlay. Implementable via Blueprint & C++. Has a default implementation, go to PoolableHelpers to find out more.
UFUNCTION(BlueprintNativeEvent, Category = "SmartPool", meta = (...))
void ReceiveSetOwningPoolComponent(UActorPoolComponent* InActorPoolComponent);
Intended to be implemented along with a member variable on actors pooled by an ActorPoolComponent. This way the pooled actor wil have access to its owning ActorPoolComponent and can therefore, for example, deactivate itself. This method is called internally and should not be called by the user.
InActorPoolComponent - Points to the pooled actors owning ActorPoolComponent.
AActor derived class meant as a quality of life improvement by providing users with the necessary minimum boilerplate needed by an actor that is being pooled by an ActorPoolComponent. The class also extends behaviour regarding multiplayer compatibility to ensure the following:
Default Activation/Deactivation is properly replicated across all clients using a NetMulticast RPC.
Net Relevancy rules are altered to ensure pooled actors get properly replicated even when they are hidden and their collisions are disabled. This is especially important during initial actor pooling, as all actors start off in their deactivated state, but still need to be replicated over.
By default PooledActor has:
bReplicates - Enabled (true).
SetReplicateMovement - Enabled (true).
virtual bool IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const override;
Unreal method overriden an altered to return true despite actor being hidden, otherwise uses Unreals own logic.
UActorPoolComponent* GetOwningPoolComponent() const;
C++ facing getter providing access to the pooled actors owning ActorPoolComponent.
UFUNCTION(NetMulticast, Reliable, meta = (...))
void Multicast_DefaultActiveState_Internal(const bool bIsActive);
NetMulticast RPC allowing for default Activation/Deactivation logic to be replicated to other clients. This method is called internally and should not be called by the user.
virtual void ReceiveSetOwningPoolComponent_Implementation(UActorPoolComponent* InActorPoolComponent) override;
Poolable method overriden used to set the OwningPoolComponent. Rejects invalid InActorPoolComponent and notifies user when re-assigning the value of OwningPoolComponent.
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "SmartPool", meta = (...))
TObjectPtr<UActorPoolComponent> OwningPoolComponent;
Pointer to the ActorPoolComponent that owns the actor. Gives the user the ability to call ActorPoolComponent methods within the pooled actor itself, such as DeactivatePooledActor.
All the delegates relating to actor pooling provided by the plugin. These delegates are used in both the PoolSubsystem and ActorPoolComponent.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPoolLoaded, const EPoolType, PoolType);
Broadcast when a pool has fully initialised all actors for the first time.Â
PoolType - Tells you the type of pool that was loaded.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPoolExpanded, AActor*, Actor, const EPoolType, PoolType);
Broadcast when a new actor is created due to insufficient pooled actor availability.
Actor - Gives you access to the newly pooled actor.
PoolType - Tells you which type of pool the newly pooled actor belongs to.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPoolDeactivated, const EPoolType, PoolType);
Broadcast when a pool has been deactivated.
PoolType - Tells you the type of pool that was deactivated.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPoolDestroyed, const EPoolType, PoolType);
Broadcast when a pool has been destroyed.
PoolType - Tells you the type of pool that was destroyed.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnActorsDeactivated, TSubclassOf<AActor>, ActorClass);
Broadcast when all pooled actors of a specific type are deactivated.
ActorClass - Tells you the type of actor that was deactivated.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnActorsDestroyed, TSubclassOf<AActor>, ActorClass);
Broadcast when all pooled actors of a specific type are destroyed.
PoolType - Tells you the type of actor that was destroyed.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPooledActorActivated, AActor*, Actor);
Broadcast when a pooled actor is activated.
Actor - Gives you access to the pooled actor that was activated.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPooledActorDeactivated, AActor*, Actor);
Broadcast when a pooled actor is deactivated.
Actor - Gives you access to the pooled actor that was deactivated.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPooledActorDestroyed, AActor*, Actor);
Broadcast when a pooled actor is destroyed.
Actor - Gives you access to the pooled actor before its fully destroyed and freed from memory.
Used as a way to identify different types of pools.
Primary use cases included:
Manipulating states of entire pools via calls like ReleasePool & ReleaseActorsOfType.
Logging information regarding pools.
Displayed inside external analytical text files and editor tools.
Display options for console commands.
None = 0 UMETA(Hidden)
Used internally for initialising empty states. Passing this value into methods that take a PoolType will result in nothing happening.
Global = 1 UMETA(DisplayName = "Global Pool")
Represents the global pool part of PoolSubsystem.
Local = 2 UMETA(DisplayName = "Local Pool")
Represents the local pool part of PoolSubsystem.
Both = 3 UMETA(DisplayName = "Both Pools (Global & Local)")
Represents both pools part of PoolSubsystem.
Component = 4 UMETA(DisplayName = "Component (Actor) Pool")
Represents pools part of ActorPoolComponents.
Used as a way to choose how pooled actors are released.
Primary use cases included:
Manipulating states of entire pools via calls like ReleasePool & ReleaseActorsOfType.
None = 0 UMETA(Hidden)
Used internally for initialising empty states. Passing this value into methods that take a PoolReleaseMode will result in nothing happening.
Deactivate UMETA(DisplayName = "Deactivate (Remain Allocated)")
Will deactivate pooled actors, ensuring they are kept in memory in case they are used again.
Deallocate UMETA(DisplayName = "Deallocate (Free Memory)")
Will deallocate pooled actors freeing them from memory. Should be used for cleanup operations only.
Custom DeveloperSettings used to hold a reference to the global profile as well as additional project wide settings.
UPROPERTY(Config, EditDefaultsOnly, Category = "SmartPool", meta = (...))
TSoftObjectPtr<UPoolProfile> GlobalPoolProfile;
Allows you to assign a PoolProfile. The assigned pool profile will be considered the global pool and loaded as such by the PoolSubsystem, unless specified otherwise by the user.
UPROPERTY(Config, EditDefaultsOnly, Category = "SmartPool", AdvancedDisplay, meta = (...))
bool bExportAnalysisOnWorldEnd;
Controls whether pool analysis should be automatically exported to an external text file for later viewing during the end of the current world before it's too late and the collected data is deleted.
Custom WorldSettings used to hold a reference to the local profile as well as additional level wide settings.
UPROPERTY(EditAnywhere, Category = "SmartPool", meta = (...))
TSoftObjectPtr<UPoolProfile> LocalPoolProfile;
Allows you to assign a PoolProfile. The assigned pool profile will be considered the local pool, for the specific map it was assigned to, and loaded as such by the PoolSubsystem.
UPROPERTY(EditAnywhere, Category = "SmartPool", AdvancedDisplay, meta = (...))
bool bUseGlobalPool;
Controls whether the specific map wants to use the global pool or not. For example, this value could be set to false for predominantly UI only maps like a Main Menu or Level Selector, where the pooling of actors is unnecessary.