Gameplay Ability System: TryActivateAbilityByClass triggers ability, even if it's not ended yet

When i use my input bindings to activate abilities, everything works fine. I can’t activate the same ability again if the EndAbility node was not reached yet.
I’m using this approach for the player character and it works just perfect.

For the AI/Enemies, i use the AbilitySystemComponent to call TryActivateAbilityByClass and provide a function for that in the enemy BP. There is an behaviour tree task that is responsible to execute that function if my player is close enough and so on.
Then i realized that the ability is executed even if EndAbility is not called. For debugging purposes, i just implemeted a Print String without EndAbility in the GameplayAbility BP to test and it proofed that the ability can be activated again, even if EndAbility was not called.

So I gave the test ability to my character with an input binding and additionally implemented the TryActivateAbilityByClass way in a BP if enter is pressed.
I got the same results. With the binded input, i can execute the ability exactly once. All subsequent calls are prevented. But i can use the enter key multiple times, which triggers the BP function TryActivateAbilityByClass and in fact, the ability gets activated for each trigger.

I expected that the ability gets prevented from the AbilitySystem to get activated again until the EndAbility node was reached, like described in the docs: Gameplay Ability | Unreal Engine Documentation.

Can someone explain what i’m doing wrong or have more experience with that? I’m using the gameplay ability system just for a couple of weeks and so i’m quit new to this.

I found the solution. In the Gameplay Ability Default Settings, i changed the Advanced → Instancing Policy value from “Instanced Per Execution” to “Instanced Per Actor” and everything works like expected.

1 Like