Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion to add explanation on how to setup "InitAttributeSetDefaults()" #127

Open
Ayliroe opened this issue Jan 28, 2024 · 0 comments
Open

Comments

@Ayliroe
Copy link

Ayliroe commented Jan 28, 2024

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, 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.

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:

[/Script/GameplayAbilities.AbilitySystemGlobals]
GlobalAttributeSetDefaultsTableNames=/Game/Blueprints/Tables/CT_GlobalAttributes.CT_GlobalAttributes

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant