While trying to setup the GAS on a project, I could not for the life of me understand how to setup IGameplayAbilitiesModule::Get().GetAbilitySystemGlobals()->GetAttributeSetInitter()->InitAttributeSetDefaults(...).
Calling GetAttributeSetInitter() always crashed, and IsAbilitySystemGlobalsInitialized() always returned false. I added #include "AbilitySystemGlobals.h", setup a a custom Asset Manager in Project Settings that calls UAbilitySystemGlobals::Get().InitGlobalData(); inside StartInitialLoading() override { ...}, tried the function in various places (a class derived from UAttributeSet, a class derived from ACharacter that implements IAbilitySystemInterface, other custom classes) to no avail.
Where CT_GlobalAttributes is an imported curve table.
Since it took me a dozen hours to figure this out due to how obscure the setup of GAS can be, I think it is worth mentioning in your GASDocumention (which otherwise has been a great help). Cheers!
Hello!
While trying to setup the GAS on a project, I could not for the life of me understand how to setup
IGameplayAbilitiesModule::Get().GetAbilitySystemGlobals()->GetAttributeSetInitter()->InitAttributeSetDefaults(...)
.Calling
GetAttributeSetInitter()
always crashed, andIsAbilitySystemGlobalsInitialized()
always returned false. I added#include "AbilitySystemGlobals.h"
, setup a a custom Asset Manager in Project Settings that callsUAbilitySystemGlobals::Get().InitGlobalData();
insideStartInitialLoading() override { ...}
, tried the function in various places (a class derived from UAttributeSet, a class derived from ACharacter that implements IAbilitySystemInterface, other custom classes) to no avail.The fix for me was tipped by a comment in that repo: https://github.com/DaedalicEntertainment/ue4-orders-abilities/blob/develop/Source/OrdersAbilities/Private/AbilitySystem/RTSAbilitySystemComponent.cpp In DefaultGame.ini, add a line such as this:
Where
CT_GlobalAttributes
is an imported curve table.Since it took me a dozen hours to figure this out due to how obscure the setup of GAS can be, I think it is worth mentioning in your GASDocumention (which otherwise has been a great help). Cheers!