Recipe: Add an Ability¶
Goal: Create a new Gameplay Ability, configure its class defaults, implement its activation logic, and grant it to a character.
Prerequisites: A C++ base ability class and a character with an ASC. See C++ vs Blueprint for the recommended setup.
Steps¶
1. Create the Blueprint¶
- In Content Browser, right-click in your
GAS/Abilities/folder - Select Blueprint Class
- Under "All Classes," search for your base ability class (e.g.,
MyGameplayAbility) -- or useGameplayAbilityif you don't have a custom base - Name it with the
GA_prefix:GA_Fireball
2. Set Class Defaults¶
Open the Blueprint and go to the Class Defaults panel:
| Property | Recommended Setting | Notes |
|---|---|---|
| Ability Tags | Ability.Combat.Ranged.Fireball |
Identifies this specific ability |
| Cancel Abilities with Tag | (leave empty or set as needed) | Abilities to cancel when this activates |
| Block Abilities with Tag | (leave empty or set as needed) | Abilities that can't activate while this is active |
| Activation Blocked Tags | CrowdControl.Stun, State.Dead |
Tags on the owner that block activation |
| Activation Required Tags | (usually empty) | Tags the owner must have to activate |
| Instancing Policy | InstancedPerActor |
Recommended default. See Instancing Policy. |
| Net Execution Policy | LocalPredicted |
For player-activated abilities. See Net Execution Policies. |
| Cost GE | Your cost effect (e.g., GE_Cost_Mana_30) |
Optional. See Cooldowns and Costs. |
| Cooldown GE | Your cooldown effect (e.g., GE_Cooldown_3s) |
Optional |
3. Wire ActivateAbility¶
In the Event Graph:
- The Event ActivateAbility node is your entry point
- Implement your ability logic:
- Play montage (via
PlayMontageAndWaittask) - Wait for events (gameplay event, input, timer)
- Apply effects to targets
- Play montage (via
- Always call EndAbility when the ability finishes
Event ActivateAbility
→ Commit Ability (checks cost + cooldown, deducts cost)
→ [Branch: success]
→ Play Montage And Wait
→ On Completed: End Ability
→ On Cancelled: End Ability
→ [Branch: fail]
→ End Ability
Always call EndAbility
An ability that never ends will block other abilities (if it has blocking tags) and leak resources. Every code path must reach EndAbility.
4. Grant to Character¶
In your character's initialization (BeginPlay or after ASC is ready):
Call Give Ability on the ASC node, passing the ability class.
Use a UGameplayAbilitySet data asset to grant a collection of abilities, effects, and attribute sets together. See Ability Sets.
5. Test¶
- PIE
- Trigger the ability (via input binding or
AbilitySystem.AbilityActivateconsole command) - Verify it activates, plays feedback, and ends cleanly
- Check
showdebug abilitysystemto confirm it appears in the ability list
Checklist¶
- Blueprint created with
GA_prefix - Class Defaults configured (tags, instancing, net policy, cost, cooldown)
-
ActivateAbilitywired with gameplay logic -
EndAbilitycalled on all exit paths - Ability granted to the character
- Tested in PIE
Related¶
- Lifecycle and Activation -- how abilities activate and end
- Bind Ability to Input -- wiring to player input
- Ability Tasks -- async operations within abilities