CustomAbilityContextBhv
This is an abstract base class that you extend when you need more control over an ability execution.
You can extend CustomAbilityContextBhv to add your own logic to an Ability. Steps:
-
Extend
CustomAbilityContextBhv -
Create a prefab that has your extension of
CustomAbilityContextBhv. -
Drop this prefab into the Custom Execution Context field of the Ability.
Lifecycle: An instance of this prefab will be created (and attached to the Runtime Ability that is being cast) when the ability is executed and no context exists yet. Thus, if you want to have a fresh context with every ability execution, you have to destroy the gameobject of the Bhv yourself. Out of the box, the context will only be destroyed when the unit is destroyed.
The Chain Lightning Demo demonstrates such a custom context.