feat(AbilitySystemComponent): Make it possible to persist attributes or abilities across respawns or possessions. #
Expose bResetAbilitiesOnSpawn / bResetAttributesOnSpawn to make it possible to persist attributes or abilities across respawns or possessions.
When this is set to false, abilities or attributes will only be granted the first time InitAbilityActor is called. This is the default
behavior for ASC living on Player States (GSCModularPlayerState specifically).
Also fixes an issue with PlayerState's ASC and ability input binding when player is respawned (in case of abilities cleared and granted again). In that case, PlayerState's ASC must keep bResetAbilitiesOnSpawn to false.
How to Use #
For Player State's ASC, reset abilities is set to false by default.
Making both attributes and abilities to persist across Pawn's respawn and / or possessions.
For abilities, it is required to persist them (bResetAbilitiesOnSpawn should remain false) for ability input binding to continue working.
For attributes, if persisted, game logic has to decide whether they need to be initialized again to their default values (for example on death, you may want to have Health to be at max level again).
Example:
For ASC living on Pawns, they are both set to true by default (matches previous behavior).
But you are free to change this. In this case, since ASC is living on Pawns, this is only relevant for possession changes. In case of respawn (on death for instance), both abilities / attributes are wiped out since ASC is recreated as part of the Actor being destroyed / respawned.