PossessAction
Abstract Action subclass providing possess/release context. Executed during possession transitions by Possessor and Possessable to run custom logic (e.g., camera transitions, animation triggers, UI changes).
Definition
Namespace: Paragon.Townskeep.PossessionSystem Assembly: Townskeep.dll
[Serializable]
public abstract class PossessAction : ActionInheritance: Action → PossessAction
Remarks
PossessAction is a thin wrapper around Action that adds a context-aware Execute(Possessor, Possessable) overload. This sets the possessor and possessable protected fields before delegating to the standard Action.Execute() pipeline.
Both Possessor and Possessable have serialized PossessAction fields:
Possessor has
possessAction(runs on possess) andreleaseAction(runs on release)Possessable has
possessedAction(runs when possessed) andreleasedAction(runs when released)
This means up to four PossessAction instances can fire during a single possess transition.
Quick Lookup
Create a custom action
Subclass PossessAction, override OnExecute()
Access the possessor
this.possessor (protected field)
Access the possessable
this.possessable (protected field)
Assign in Inspector
Serialize on Possessor or Possessable components
Methods
Execute (context overload)
Sets the possess/release context and starts execution.
possessor
Possessor
The possessor involved in the transition
possessable
Possessable
The possessable involved in the transition
This calls the inherited Action.Execute() (fire-and-forget) after setting context fields. The action runs asynchronously via the CancellableTask pipeline.
Extension Points
Required Overrides
OnExecute()
Task
Core logic of the possess/release action (inherited from Action)
Optional Overrides
OnBegin()
void
Setup before execution
OnComplete()
void
Cleanup on success
OnCancel()
void
Cleanup on cancellation
OnEnd()
void
Final cleanup regardless of outcome
Implementation Requirements
When subclassing PossessAction, you MUST:
Override
OnExecute()and return aTaskMark the class with
[Serializable]
You SHOULD:
Use
Yieldmethods for frame-based waiting (integrates with cancellation)Access
possessorandpossessableonly withinOnExecute()or later lifecycle hooksUse
[Variable]for configurable parameters
Fields (protected)
possessor
The entity taking or releasing control.
possessable
The entity being possessed or released.
Common Pitfalls
Context is set before Execute The possessor and possessable fields are set immediately before Execute() is called. They are available in OnBegin() and OnExecute(), but they are overwritten on each call — do not cache state between invocations.
Fire-and-forget execution Execute(Possessor, Possessable) calls the non-awaited Execute(). The possess transition does not wait for the action to complete. If your action is long-running, the possession state will already be set before the action finishes.
Examples
Camera Transition on Possess
Instant Action (synchronous)
See Also
Action — base class providing async execution
Possessor — component that triggers possess actions
Possessable — component that triggers possessed actions
PossessInteraction — interaction-system bridge for possession
Last updated