The GameplayAbilities API can be used to attach C++ functions to invoke on certain button pushes, triggering the game unit to exhibit its abilities during play in response to keystroke events. In this recipe, we will show you how to do that.
Enumerate and describe your game character's abilities. You will need to know what your character does in response to key events to code in this recipe.
There are several objects that we need to use here; they are as follows:
UGameplayAbility
class—this is needed to derivate the C++ class instances of theUGameplayAbility
class, one derivative class for each ability.Define what each ability does in
.h
and.cpp
by overriding available functions, such asUGameplayAbility::ActivateAbility
,UGameplayAbility::InputPressed
,UGameplayAbility::CheckCost
,UGameplayAbility::ApplyCost
,UGameplayAbility::ApplyCooldown
, and so on
GameplayAbilitiesSet
—this is aDataAsset...