GAS, AttributeSet not created in PIE when Actor is placed in world

Hello,

I am using Gameplay Ability System for my project and I have a situation with attribute set.

I declared it in my character constructor using “CreateSubObject”, and as attended it is automatically seen by the Ability System Component when I spawn a new character.

But if my character is already placed in world, when I play in Editor, with PIE or viewport, the attribute set is not created (or the ability system component do not see it). It works in standalone, even in editor.

I struggle to debug this because I couldn’t find logs and I do not know where to start. Can anyone help me about this please ?

Thanks a lot.

the issue you are experiencing may be related to the order in which objects are initialized when running in the Editor.

When running in standalone mode, all objects are initialized before the game begins, so the attribute set is created and visible to the Ability System Component.

However,

when running in the Editor, objects may be initialized in a different order, which can cause issues with object dependencies.

One possible solution is to move the creation of the attribute set to the BeginPlay() function in your character class.
This ensures that the attribute set is created after all necessary objects have been initialized, and should be visible to the Ability System Component.

Another option is to use a Blueprint script to create the attribute set, which may provide more control over the initialization order. In the Blueprint, you can use the “Begin Play” event to create the attribute set and ensure that it is visible to the Ability System Component.

Finally, you can try enabling logging for the Ability System Component to see if any errors are being logged. To do this, add the following line to your game’s configuration file (DefaultEngine.ini):

[/Script/GameplayAbilities.AbilitySystemComponent]
LogCategory = Log

This will enable logging for the Ability System Component, which may provide more information about the issue you are experiencing. You can view the logs in the Output Log window in the Editor :eyes:

2 Likes