AbilitySystem.GameplayEffects.MaxVersion
AbilitySystem.GameplayEffects.MaxVersion
#Overview
name: AbilitySystem.GameplayEffects.MaxVersion
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override the Gameplay Effect Current Version (disabling upgrade code paths)
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AbilitySystem.GameplayEffects.MaxVersion is to control the version of Gameplay Effects in Unreal Engine’s Ability System. It is used to override the current version of Gameplay Effects and potentially disable upgrade code paths.
This setting variable is primarily used by the Gameplay Abilities system, which is a plugin in Unreal Engine 5. It’s specifically utilized within the GameplayEffect module of this system.
The value of this variable is set through a console variable (CVar) named CVarGameplayEffectMaxVersion. It’s initialized with the current version of EGameplayEffectVersion enum.
This variable interacts closely with the EGameplayEffectVersion enum. It’s used to determine whether version upgrades should occur and to set the version of Gameplay Effects.
Developers must be aware that this variable can affect the behavior of Gameplay Effects, particularly in terms of version compatibility and upgrades. Changing this value could potentially disable upgrade code paths, which might be necessary for maintaining backwards compatibility or resolving version-specific issues.
Best practices when using this variable include:
- Only modify it if you fully understand the implications on your game’s Gameplay Effects.
- Use it cautiously in production environments, as it can affect game balance and functionality.
- Consider using it for debugging or testing specific versions of Gameplay Effects.
Regarding the associated variable CVarGameplayEffectMaxVersion:
The purpose of CVarGameplayEffectMaxVersion is to provide a console-accessible way to control the AbilitySystem.GameplayEffects.MaxVersion setting. It’s a TAutoConsoleVariable
This variable is used in the same Gameplay Abilities system, specifically within the GameplayEffect module. It’s the actual implementation of the console variable that controls the max version.
The value of CVarGameplayEffectMaxVersion is set when the console variable is initialized, and it can be changed at runtime through console commands.
It interacts directly with the EGameplayEffectVersion enum, converting between the int32 stored in the console variable and the enum values used in the code.
Developers should be aware that changes to this variable will immediately affect the behavior of Gameplay Effects, potentially in all active game sessions if changed globally.
Best practices for CVarGameplayEffectMaxVersion include:
- Use it for debugging and testing different versions of Gameplay Effects.
- Be cautious about changing it in shipping builds, as it could lead to unexpected behavior.
- Document any non-default values used in different environments (development, testing, production) to ensure consistency.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffect.cpp:82
Scope (from outer to inner):
file
namespace UE::GameplayEffect
Source code excerpt:
inline bool HasActiveGameplayEffectFix(EActiveGameplayEffectFix Flag) { return (ActiveGameplayEffectReplicationFix & static_cast<int32>(Flag)) != 0; }
TAutoConsoleVariable<int32> CVarGameplayEffectMaxVersion(TEXT("AbilitySystem.GameplayEffects.MaxVersion"), (int32)EGameplayEffectVersion::Current, TEXT("Override the Gameplay Effect Current Version (disabling upgrade code paths)"), ECVF_Default);
// Fix introduced in UE5.4
bool bUseModifierTagRequirementsOnAllGameplayEffects = true;
FAutoConsoleVariableRef CVarUseModTagReqsOnAllGE{ TEXT("AbilitySystem.Fix.UseModTagReqsOnAllGE"), bUseModifierTagRequirementsOnAllGameplayEffects, TEXT("Fix an issue where MustHave/MustNotHave tags did not apply to Instant and Periodic Gameplay Effects"), ECVF_Default };
// Fix introduced in UE5.4
#Associated Variable and Callsites
This variable is associated with another variable named CVarGameplayEffectMaxVersion
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffect.cpp:82
Scope (from outer to inner):
file
namespace UE::GameplayEffect
Source code excerpt:
inline bool HasActiveGameplayEffectFix(EActiveGameplayEffectFix Flag) { return (ActiveGameplayEffectReplicationFix & static_cast<int32>(Flag)) != 0; }
TAutoConsoleVariable<int32> CVarGameplayEffectMaxVersion(TEXT("AbilitySystem.GameplayEffects.MaxVersion"), (int32)EGameplayEffectVersion::Current, TEXT("Override the Gameplay Effect Current Version (disabling upgrade code paths)"), ECVF_Default);
// Fix introduced in UE5.4
bool bUseModifierTagRequirementsOnAllGameplayEffects = true;
FAutoConsoleVariableRef CVarUseModTagReqsOnAllGE{ TEXT("AbilitySystem.Fix.UseModTagReqsOnAllGE"), bUseModifierTagRequirementsOnAllGameplayEffects, TEXT("Fix an issue where MustHave/MustNotHave tags did not apply to Instant and Periodic Gameplay Effects"), ECVF_Default };
// Fix introduced in UE5.4
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffect.cpp:99
Scope (from outer to inner):
file
namespace UE::GameplayEffect
namespace EditorOnly
function static bool ShouldUpgradeVersion
Source code excerpt:
static bool ShouldUpgradeVersion(EGameplayEffectVersion FromVersion, EGameplayEffectVersion ToVersion)
{
EGameplayEffectVersion MaxVersion = static_cast<EGameplayEffectVersion>(CVarGameplayEffectMaxVersion.GetValueOnAnyThread() & 0xff);
if (MaxVersion < ToVersion)
{
return false;
}
return FromVersion < ToVersion;
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffect.cpp:173
Scope (from outer to inner):
file
function void UGameplayEffect::PostInitProperties
Source code excerpt:
{
constexpr bool bForceGameThreadValue = true;
SetVersion(static_cast<EGameplayEffectVersion>(UE::GameplayEffect::CVarGameplayEffectMaxVersion.GetValueOnAnyThread(bForceGameThreadValue)));
}
else
{
SetVersion(EGameplayEffectVersion::Monolithic);
}
}
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffect.cpp:316
Scope (from outer to inner):
file
function void UGameplayEffect::PostLoad
Source code excerpt:
// We're done loading (and therefore upgrading), boost the version.
SetVersion( static_cast<EGameplayEffectVersion>(UE::GameplayEffect::CVarGameplayEffectMaxVersion.GetValueOnGameThread()) );
#endif // WITH_EDITOR
}
void UGameplayEffect::OnGameplayEffectChanged()
{
if (HasAnyFlags(RF_NeedPostLoad))