Class AbilityObjectSnapshot
Immutable snapshot of ability data, captured lazily at the moment an object is detached from its ability (DetachAllAbilityObjects()), not at spawn. If events were removed from the ability between spawn and detach the snapshot reflects the ability as it was at detach. Allows an AbilityObject to persist and function independently after the owning character disconnects, dies, or is otherwise cleaned up. When the live Ability reference becomes null (e.g., after detach), the AbilityObject falls back to this snapshot for lifetime checks, event dispatch, and collision handling.
public sealed class AbilityObjectSnapshot
- Inheritance
-
AbilityObjectSnapshot
- Inherited Members
Constructors
AbilityObjectSnapshot(Ability)
Creates a snapshot from a live Ability instance. Each event map is copied into a new key-ordered dictionary and assigned to an IReadOnlyDictionary<TKey, TValue> field. This isolates the snapshot from later mutations via RemoveAbilityEvent(int) while still sharing the immutable ScriptableObject event template values.
public AbilityObjectSnapshot(Ability ability)
Parameters
abilityAbilityThe ability to snapshot. Must not be null.
Fields
LifeTime
Total configured lifetime of the ability. Used for the lifetime countdown check when the live Ability is no longer available.
public readonly float LifeTime
Field Value
OnDestroyEvents
Snapshot of OnDestroy event triggers for cleanup dispatching. See OnTickEvents for immutability rationale.
public readonly IReadOnlyDictionary<int, AbilityOnDestroyEvent> OnDestroyEvents
Field Value
OnHitEvents
Snapshot of OnHit event triggers for collision hit dispatching. See OnTickEvents for immutability rationale.
public readonly IReadOnlyDictionary<int, AbilityOnHitEvent> OnHitEvents
Field Value
OnTickEvents
Snapshot of OnTick event triggers for continued ticking. Stored as IReadOnlyDictionary<TKey, TValue> backed by a shallow, KEY-ORDERED copy of the live Ability map — see CopyOrEmpty<TEvent>(IReadOnlyDictionary<int, TEvent>, IReadOnlyDictionary<int, TEvent>) for why the ordering has to survive the copy. Exposing it read-only prevents new entries without the overhead of a wrapper, so the snapshot stays effectively immutable even if the live ability's event maps are later modified by RemoveAbilityEvent(int).
Do NOT cast this field to its concrete dictionary type. Casting bypasses the readonly contract and may allow accidental mutation of the snapshot's internal state.
public readonly IReadOnlyDictionary<int, AbilityOnTickEvent> OnTickEvents
Field Value
Speed
Speed of the ability, used for movement actions.
public readonly float Speed