UAbilityAsync is a version of UCancellableAsyncAction, with Gameplay Ability System-specific functionality.

The difference between this and AbilityTask is that AbilityAsyncs can be used from any graph, and not only inside GameplayAbilities. As such, it’s useful for general purpose ability-related helpers.

Usage

The basic usage is similar to Gameplay Tasks and UBlueprintAsyncActionBase.

  • Create a class which extends UAbilityAsync
  • Give it a static factory function, which creates the async object via NewObject
  • Add the other necessary functions, like Activate and EndAction

Other usage notes

  • You usually would pass either an ability system, or an actor which uses an ability system into the static factory function.
  • You can call either SetAbilityActor or SetAbilitySystemComponent in the factory to initialize the async action correctly.
  • Within Activate or other functions, use GetAbilitySystemComponent() to get the ability system component
  • When broadcasting delegates, call ShouldBroadcastDelegates() to determine whether it’s still valid to do so
  • Call EndAction() when the action is intended to end.