AbilitySystem.SetActivationInfoMultipleTimes
AbilitySystem.SetActivationInfoMultipleTimes
#Overview
name: AbilitySystem.SetActivationInfoMultipleTimes
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set this to true if some replicated Gameplay Abilities aren\'t setting their owning actors correctly
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AbilitySystem.SetActivationInfoMultipleTimes is to control whether replicated Gameplay Abilities can set their owning actors multiple times. This setting is primarily used in the Ability System component of Unreal Engine 5.
This setting variable is relied upon by the GameplayAbilities plugin, specifically within the AbilitySystemComponent. It’s used in the context of ability activation and replication.
The value of this variable is set as a console variable (CVar) in the C++ code. It’s initialized to false by default, meaning that by default, abilities are not allowed to set their activation info multiple times.
The associated variable CVarAbilitySystemSetActivationInfoMultipleTimes directly interacts with this setting. They share the same value and purpose.
Developers must be aware that this variable is intended to fix issues where replicated Gameplay Abilities aren’t setting their owning actors correctly. Enabling this setting allows the ability to set its current activation info multiple times, which can be necessary in some replication scenarios.
Best practices when using this variable include:
- Keep it disabled (false) by default.
- Only enable it if you’re experiencing issues with replicated Gameplay Abilities not setting their owning actors correctly.
- Be cautious when enabling this, as it may have implications for ability replication and network performance.
- Test thoroughly in networked environments when changing this setting.
Regarding the associated variable CVarAbilitySystemSetActivationInfoMultipleTimes:
This is the actual console variable that controls the behavior. It’s defined as a static TAutoConsoleVariable
The variable is used in the InternalTryActivateAbility function of the UAbilitySystemComponent class. When enabled, it allows the InstancedAbility to set its current activation info, which is typically only set locally.
Developers should be aware that this variable provides a way to modify the behavior at runtime, which can be useful for debugging but should be used carefully in production environments.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp:47
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarReplayMontageErrorThreshold(TEXT("replay.MontageErrorThreshold"), 0.5f, TEXT("Tolerance level for when montage playback position correction occurs in replays"));
static TAutoConsoleVariable<bool> CVarAbilitySystemSetActivationInfoMultipleTimes(TEXT("AbilitySystem.SetActivationInfoMultipleTimes"), false, TEXT("Set this to true if some replicated Gameplay Abilities aren't setting their owning actors correctly"));
static TAutoConsoleVariable<bool> CVarGasFixClientSideMontageBlendOutTime(TEXT("AbilitySystem.Fix.ClientSideMontageBlendOutTime"), true, TEXT("Enable a fix to replicate the Montage BlendOutTime for (recently) stopped Montages"));
static TAutoConsoleVariable<bool> CVarUpdateMontageSectionIdToPlay(TEXT("AbilitySystem.UpdateMontageSectionIdToPlay"), true, TEXT("During tick, update the section ID that replicated montages should use"));
static TAutoConsoleVariable<bool> CVarReplicateMontageNextSectionId(TEXT("AbilitySystem.ReplicateMontageNextSectionId"), true, TEXT("Apply the replicated next section Id to montages when skipping position replication"));
static TAutoConsoleVariable<bool> CVarEnsureAbilitiesEndGracefully(TEXT("AbilitySystem.EnsureAbilitiesEndGracefully"), true, TEXT("When shutting down (during ClearAllAbilities) we should check if all GameplayAbilities gracefully ended. This should be disabled if you have NonInstanced abilities that are designed for multiple concurrent executions."));
void UAbilitySystemComponent::InitializeComponent()
#Associated Variable and Callsites
This variable is associated with another variable named CVarAbilitySystemSetActivationInfoMultipleTimes
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp:47
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarReplayMontageErrorThreshold(TEXT("replay.MontageErrorThreshold"), 0.5f, TEXT("Tolerance level for when montage playback position correction occurs in replays"));
static TAutoConsoleVariable<bool> CVarAbilitySystemSetActivationInfoMultipleTimes(TEXT("AbilitySystem.SetActivationInfoMultipleTimes"), false, TEXT("Set this to true if some replicated Gameplay Abilities aren't setting their owning actors correctly"));
static TAutoConsoleVariable<bool> CVarGasFixClientSideMontageBlendOutTime(TEXT("AbilitySystem.Fix.ClientSideMontageBlendOutTime"), true, TEXT("Enable a fix to replicate the Montage BlendOutTime for (recently) stopped Montages"));
static TAutoConsoleVariable<bool> CVarUpdateMontageSectionIdToPlay(TEXT("AbilitySystem.UpdateMontageSectionIdToPlay"), true, TEXT("During tick, update the section ID that replicated montages should use"));
static TAutoConsoleVariable<bool> CVarReplicateMontageNextSectionId(TEXT("AbilitySystem.ReplicateMontageNextSectionId"), true, TEXT("Apply the replicated next section Id to montages when skipping position replication"));
static TAutoConsoleVariable<bool> CVarEnsureAbilitiesEndGracefully(TEXT("AbilitySystem.EnsureAbilitiesEndGracefully"), true, TEXT("When shutting down (during ClearAllAbilities) we should check if all GameplayAbilities gracefully ended. This should be disabled if you have NonInstanced abilities that are designed for multiple concurrent executions."));
void UAbilitySystemComponent::InitializeComponent()
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp:1900
Scope (from outer to inner):
file
function bool UAbilitySystemComponent::InternalTryActivateAbility
Source code excerpt:
// UGameplayAbility::PreActivate actually sets this internally (via SetCurrentInfo) which happens after replication (this is only set locally). Let's cautiously remove this code.
if (CVarAbilitySystemSetActivationInfoMultipleTimes.GetValueOnGameThread())
{
InstancedAbility->SetCurrentActivationInfo(ActivationInfo); // Need to push this to the ability if it was instanced.
}
}
MarkAbilitySpecDirty(*Spec);