Actions

Ability Scratchpad

From Able Ability System Wiki

Ability Scratchpad[edit]

Must like the Task Scratchpad, the Ability Scratchpad is a small, optional structure that is allocated when an Ability is activated. The Scratchpad is allocated by returning a valid subclass of UAblAbilityScratchPad in the Ability's Get Ability Scratchpad Class method, which can be overwritten in Blueprints or C++. This structure can be used to hold per-execution data, or data you wish to read/write between Tasks. You can access the Ability Scratchpad by calling the Ability Context's Get Ability Scratchpad method and then casting it to whichever class you told it to create.

Much like the Task version, the Ability Scratchpad has similar caveats:

  • Returning nullptr as the Ability Scratchpad class will prevent the Scratchpad from being allocated, saving memory.
  • Ability Scratchpad is NOT replicated between Server/Client.
  • Only one Ability Scratchpad is ever created per Ability execution; so if you have a looping Ability - watch out for stale data from previous runs.
  • The Scratchpad is NOT thread safe. So Async Tasks should be very careful how they read/write to it (or just avoid doing so entirely).