NiagaraDynamicParametersListenerComponent Documentation
Core Concept
The fundamental principle of this system is simple: The component maintains a set of active gameplay tags accessible via GetActiveGameplayTags()
that returns the ActiveGameplayTags
property, and these tags determine which parameter overrides are applied to registered Niagara effects.
Everything else is optional utility functionality. You can implement your own custom logic and simply call UpdateGameplayTags(NewTags)
to replace the active tags whenever your game state changes. The component will automatically apply the appropriate parameter overrides based on the new tags.
Essential Methods
GetActiveGameplayTags()
- Returns the current active tags that drive parameter overridesUpdateGameplayTags(NewTags)
- Replaces all active tags with your custom set
Optional Utility Methods
All other methods are convenience utilities for the built-in tag management and effect registration system:
AddGameplayTags()
/RemoveGameplayTags()
- Incremental tag modificationsRegisterNiagaraEffect()
/UnregisterNiagaraEffect()
- Built-in effect registration systemRefreshAllEffects()
/CleanupInactiveEffects()
- Maintenance utilities- Query methods and events - Information and debugging support
You can ignore the built-in utilities and create your own system that calls UpdateGameplayTags()
based on any custom logic (AI states, player actions, environmental conditions, etc.).
Overview
The UDNAListenerComponent
is the core component of the Dynamic Niagara for Animation (DNA) system. It manages gameplay tag-based parameter overrides for Niagara effects, enabling dynamic visual effects that respond to game state changes in real-time.
Component Setup
Adding to an Actor
// C++ - Add to actor constructor
ListenerComponent = CreateDefaultSubobject<UDNAListenerComponent>(TEXT("DNAListener"));
// Blueprint - Add Component in the Components panel
Add Component -> DNA - Listener Component
Basic Configuration
Property | Type | Default | Description |
---|---|---|---|
bEnabled | bool | true | Master enable/disable switch for the entire component |
bAutoCleanupInactiveEffects | bool | true | Whether to automatically clean up inactive effects using a timer |
CleanupInterval | float | 1.0 | How often to check for and clean up inactive effects (seconds) |
bLogParameterChanges | bool | false | Whether to log parameter changes for debugging |
Blueprint API Reference
Network Authority
HasNetworkAuthority
HasNetworkAuthority() -> bool
Category: Niagara Dynamic Parameters|Network
Type: BlueprintPure
Checks if this component has network authority to modify gameplay tags.
Returns:
bool
: True if component has authority (server in multiplayer, always true in standalone)
Usage Example:
if (DNAListener.HasNetworkAuthority())
{
// Safe to modify tags
DNAListener.AddGameplayTags(NewTags);
}
Gameplay Tag Management
AddGameplayTags
AddGameplayTags(TagsToAdd: GameplayTagContainer)
Category: Niagara Dynamic Parameters|Gameplay Tags
Type: BlueprintCallable, BlueprintNativeEvent
Adds new gameplay tags to the active tag container. Triggers parameter updates on all registered effects.
Parameters:
TagsToAdd
(FGameplayTagContainer
): Container of gameplay tags to add to the active set
Authority: Requires network authority. Will log warning and return early if called without authority.
Usage Example:
// Add combat-related tags
TagContainer CombatTags;
CombatTags.AddTag("Combat.Active");
CombatTags.AddTag("Combat.Melee");
DNAListener.AddGameplayTags(CombatTags);
UpdateGameplayTags
UpdateGameplayTags(NewTags: GameplayTagContainer)
Category: Niagara Dynamic Parameters|Gameplay Tags
Type: BlueprintCallable
Replaces the entire active gameplay tag container with new tags.
Parameters:
NewTags
(FGameplayTagContainer
): New set of gameplay tags to replace current active tags
Authority: Requires network authority.
Usage Example:
// Switch from combat to stealth mode
TagContainer StealthTags;
StealthTags.AddTag("Stealth.Active");
StealthTags.AddTag("Movement.Crouched");
DNAListener.UpdateGameplayTags(StealthTags);
RemoveGameplayTags
RemoveGameplayTags(TagsToRemove: GameplayTagContainer, RemovalMode: EGameplayTagRemovalMode)
Category: Niagara Dynamic Parameters|Gameplay Tags
Type: BlueprintCallable, BlueprintNativeEvent
Removes gameplay tags from the active tag container.
Parameters:
TagsToRemove
(FGameplayTagContainer
): Container of gameplay tags to removeRemovalMode
(EGameplayTagRemovalMode
): How to handle tag removal
Removal Modes:
ExactMatch
: Remove only exact matching tagsWithDescendants
: Remove the tag and all its descendant tags (e.g., "Combat.Melee" removes "Combat.Melee.Sword")
Authority: Requires network authority.
Usage Example:
// Remove all combat-related tags and their children
TagContainer CombatTags;
CombatTags.AddTag("Combat");
DNAListener.RemoveGameplayTags(CombatTags, EGameplayTagRemovalMode::WithDescendants);
GetTagsWithDescendants
GetTagsWithDescendants(Tags: GameplayTagContainer) -> GameplayTagContainer
Category: Niagara Dynamic Parameters|Gameplay Tags
Type: BlueprintCallable, Static
Utility function to get a tag container that includes specified tags and all their descendants.
Parameters:
Tags
(FGameplayTagContainer
): Input tags to expand with descendants
Returns:
FGameplayTagContainer
: Container with original tags plus all descendant tags
Usage Example:
// Get all combat-related tags including children
TagContainer CombatBase;
CombatBase.AddTag("Combat");
GameplayTagContainer AllCombatTags = GetTagsWithDescendants(CombatBase);
// Result might include: Combat, Combat.Melee, Combat.Ranged, Combat.Melee.Sword, etc.
Effect Management
RegisterNiagaraEffect
RegisterNiagaraEffect(NiagaraComponent: NiagaraComponent, Configuration: NiagaraSystemConfiguration, SourceNotifyName: string = "")
Category: Niagara Dynamic Parameters|Effect Management
Type: BlueprintCallable
Registers a Niagara component with this listener to receive dynamic parameter updates.
Parameters:
NiagaraComponent
(UNiagaraComponent*
): The Niagara component to registerConfiguration
(FNiagaraSystemConfiguration
): System configuration containing parameter override rulesSourceNotifyName
(FString
): Optional name of the animation notify that spawned this effect (for debugging)
Usage Example:
// Register an effect spawned by an animation notify
NiagaraComponent SpawnedEffect = SpawnNiagaraSystem(...);
DNAListener.RegisterNiagaraEffect(SpawnedEffect, EffectConfiguration, "Attack_Slash_Notify");
UnregisterNiagaraEffect
UnregisterNiagaraEffect(NiagaraComponent: NiagaraComponent)
Category: Niagara Dynamic Parameters|Effect Management
Type: BlueprintCallable
Unregisters a Niagara component from this listener, stopping dynamic parameter updates.
Parameters:
NiagaraComponent
(UNiagaraComponent*
): The Niagara component to unregister
Usage Example:
// Manually unregister an effect
DNAListener.UnregisterNiagaraEffect(MyNiagaraEffect);
RefreshAllEffects
RefreshAllEffects()
Category: Niagara Dynamic Parameters|Effect Management
Type: BlueprintCallable
Forces a refresh of parameter overrides on all registered Niagara effects. Automatically called when gameplay tags change.
Usage Example:
// Force refresh after manual parameter changes
DNAListener.RefreshAllEffects();
CleanupInactiveEffects
CleanupInactiveEffects()
Category: Niagara Dynamic Parameters|Effect Management
Type: BlueprintCallable
Manually removes inactive effects from the registration list. Automatically done based on cleanup settings.
Usage Example:
// Manual cleanup trigger
DNAListener.CleanupInactiveEffects();
Queries and Getters
GetActiveGameplayTags
GetActiveGameplayTags() -> GameplayTagContainer
Category: Niagara Dynamic Parameters|Queries
Type: BlueprintCallable, BlueprintNativeEvent
Gets the currently active gameplay tags.
Returns:
FGameplayTagContainer
: Container with all currently active gameplay tags
Usage Example:
GameplayTagContainer CurrentTags = DNAListener.GetActiveGameplayTags();
if (CurrentTags.HasTag("Combat.Active"))
{
// Player is in combat
}
GetActiveNiagaraComponents
GetActiveNiagaraComponents() -> Array<NiagaraComponent>
Category: Niagara Dynamic Parameters|Queries
Type: BlueprintPure
Gets all currently registered and active Niagara components.
Returns:
TArray<UNiagaraComponent*>
: Array of active Niagara components
Usage Example:
Array<NiagaraComponent> ActiveEffects = DNAListener.GetActiveNiagaraComponents();
PrintString("Active effects count: " + string(ActiveEffects.Length));
GetActiveEffectCount
GetActiveEffectCount() -> int32
Category: Niagara Dynamic Parameters|Queries
Type: BlueprintPure
Gets the number of currently registered effects.
Returns:
int32
: Number of effects currently registered with this listener
Usage Example:
int32 EffectCount = DNAListener.GetActiveEffectCount();
if (EffectCount > 10)
{
// Too many effects, maybe cleanup needed
}
GetActiveEffects
GetActiveEffects() -> Array<ActiveNiagaraEffectInfo>
Category: Debug
Type: BlueprintPure
Gets detailed information about all active effects (primarily for debugging).
Returns:
TArray<FActiveNiagaraEffectInfo>
: Array of effect info structures
Usage Example:
Array<ActiveNiagaraEffectInfo> EffectInfos = DNAListener.GetActiveEffects();
ForEach EffectInfo in EffectInfos
{
PrintString("Effect: " + EffectInfo.SourceNotifyName + " - Spawn Time: " + string(EffectInfo.SpawnTime));
}
Events
OnParametersUpdated
OnParametersUpdated(ActiveTags: GameplayTagContainer, AppliedOverrides: Array<NiagaraParameterOverride>)
Category: Events
Type: BlueprintAssignable (Multicast Delegate)
Event fired whenever parameters are updated on registered effects.
Parameters:
ActiveTags
(FGameplayTagContainer
): The currently active gameplay tagsAppliedOverrides
(TArray<FNiagaraParameterOverride>
): Array of parameter overrides that were applied
Usage Example:
// Bind to the event
DNAListener.OnParametersUpdated.AddDynamic(this, HandleParametersUpdated);
// Event handler function
function HandleParametersUpdated(ActiveTags: GameplayTagContainer, AppliedOverrides: Array<NiagaraParameterOverride>)
{
PrintString("Parameters updated! Active tags: " + ActiveTags.ToString());
PrintString("Applied " + string(AppliedOverrides.Length) + " overrides");
}
Data Types
EGameplayTagRemovalMode
Enumeration defining how gameplay tags should be removed from the active tag container.
Value | Description |
---|---|
ExactMatch | Remove only exact matching tags |
WithDescendants | Remove the tag and all its descendant tags |
FActiveNiagaraEffectInfo
Structure containing information about an active Niagara effect registered with the listener component.
Property | Type | Description |
---|---|---|
NiagaraComponent | TWeakObjectPtr<UNiagaraComponent> | Weak reference to the registered Niagara component |
Configuration | FNiagaraSystemConfiguration | Configuration used for this effect including parameter overrides |
SpawnTime | float | Time when this effect was spawned (in seconds since engine start) |
SourceNotifyName | FString | Name of the animation notify that spawned this effect |
Methods:
IsValid() -> bool
: Returns true if the component is still valid and active
Usage Patterns
Basic Tag-Based Effect Control
// Setup: Register effects through animation notifies with bRegisterWithListener = true
// Game logic: Change tags based on game state
Event OnPlayerEnterCombat()
{
GameplayTagContainer CombatTags;
CombatTags.AddTag("Combat.Active");
CombatTags.AddTag("Player.State.Combat");
DNAListener.AddGameplayTags(CombatTags);
}
Event OnPlayerExitCombat()
{
GameplayTagContainer CombatTags;
CombatTags.AddTag("Combat.Active");
CombatTags.AddTag("Player.State.Combat");
DNAListener.RemoveGameplayTags(CombatTags, EGameplayTagRemovalMode::ExactMatch);
}
Monitoring and Debugging
// Enable logging for debugging
DNAListener.bLogParameterChanges = true;
// Monitor effect count
Event Tick()
{
int32 EffectCount = DNAListener.GetActiveEffectCount();
if (EffectCount > MaxAllowedEffects)
{
DNAListener.CleanupInactiveEffects();
}
}
// React to parameter updates
function OnParametersUpdated(ActiveTags: GameplayTagContainer, AppliedOverrides: Array<NiagaraParameterOverride>)
{
// Log or react to parameter changes
PrintString("Parameter update - Tag count: " + string(ActiveTags.Num()) +
", Override count: " + string(AppliedOverrides.Length));
}
Network Considerations
// Only modify tags on authority
function ChangePlayerState(NewState: GameplayTag)
{
if (DNAListener.HasNetworkAuthority())
{
GameplayTagContainer NewTags;
NewTags.AddTag(NewState);
DNAListener.UpdateGameplayTags(NewTags);
}
else
{
// On clients, tags will be replicated from server
PrintString("Waiting for server tag update...");
}
}
Performance Considerations
Cleanup Management
- Auto Cleanup: Enable
bAutoCleanupInactiveEffects
for automatic management - Manual Cleanup: Disable auto cleanup and call
CleanupInactiveEffects()
during appropriate game moments - Cleanup Interval: Adjust
CleanupInterval
based on effect spawn frequency