AbilitySystemGlobalsClassName

AbilitySystemGlobalsClassName

#Overview

name: AbilitySystemGlobalsClassName

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of AbilitySystemGlobalsClassName is to specify the class that should be instantiated as the globals object for the Ability System in Unreal Engine 5. This setting variable is crucial for the Gameplay Abilities system, which is a core component of UE5’s gameplay framework.

This setting variable is primarily used within the GameplayAbilities module, which is a plugin that provides a flexible framework for implementing gameplay abilities, attributes, and effects in games.

The value of AbilitySystemGlobalsClassName is set in the constructor of UAbilitySystemGlobals class, with a default value of “/Script/GameplayAbilities.AbilitySystemGlobals”. However, this value can be overridden through configuration files.

The AbilitySystemGlobalsClassName interacts with the GetAbilitySystemGlobals() function in the FGameplayAbilitiesModule class. This function uses the value of AbilitySystemGlobalsClassName to load and instantiate the appropriate UAbilitySystemGlobals object.

Developers must be aware that changing this variable will affect the entire Ability System’s behavior, as it determines which class is used for the global Ability System object. Incorrect configuration could lead to runtime errors or unexpected behavior in the Ability System.

Best practices when using this variable include:

  1. Only modify it if you need to extend or customize the base AbilitySystemGlobals functionality.
  2. Ensure that the class specified by AbilitySystemGlobalsClassName inherits from UAbilitySystemGlobals.
  3. If overriding, make sure the new class is fully implemented and tested before deployment.
  4. Use configuration files to set this value rather than hard-coding it, allowing for easier adjustments across different game modes or builds.
  5. Document any changes to this variable thoroughly, as it affects a core system used by many parts of the game.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:15, section: [/Script/GameplayAbilities.AbilitySystemGlobals]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemGlobals.cpp:41

Scope (from outer to inner):

file
function     UAbilitySystemGlobals::UAbilitySystemGlobals

Source code excerpt:

: Super(ObjectInitializer)
{
	AbilitySystemGlobalsClassName = FSoftClassPath(TEXT("/Script/GameplayAbilities.AbilitySystemGlobals"));

	bUseDebugTargetFromHud = false;

	PredictTargetGameplayEffects = true;

	ReplicateActivationOwnedTags = true;

#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayAbilitiesModule.cpp:26

Scope (from outer to inner):

file
class        class FGameplayAbilitiesModule : public IGameplayAbilitiesModule
function     virtual UAbilitySystemGlobals* GetAbilitySystemGlobals

Source code excerpt:

		{
			QUICK_SCOPE_CYCLE_COUNTER(STAT_IGameplayAbilitiesModule_GetAbilitySystemGlobals_LoadModule);
			FSoftClassPath AbilitySystemClassName = (UAbilitySystemGlobals::StaticClass()->GetDefaultObject<UAbilitySystemGlobals>())->AbilitySystemGlobalsClassName;

			UClass* SingletonClass = AbilitySystemClassName.TryLoadClass<UObject>();
			checkf(SingletonClass != nullptr, TEXT("Ability config value AbilitySystemGlobalsClassName is not a valid class name."));

			AbilitySystemGlobals = NewObject<UAbilitySystemGlobals>(GetTransientPackage(), SingletonClass, NAME_None);
			AbilitySystemGlobals->AddToRoot();

#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/AbilitySystemGlobals.h:133

Scope (from outer to inner):

file
class        class UAbilitySystemGlobals : public UObject

Source code excerpt:

	/** The class to instantiate as the globals object. Defaults to this class but can be overridden */
	UPROPERTY(config)
	FSoftClassPath AbilitySystemGlobalsClassName;

	void AutomationTestOnly_SetGlobalAttributeDataTable(UDataTable *InTable)
	{
		GlobalAttributeMetaDataTable = InTable;
	}