IPossessor
Interface that marks a MonoBehaviour as having possession capabilities. Implementors expose a Possessor component that manages the lifecycle of possessing and releasing Possessable objects.
Definition
Namespace: Paragon.Townskeep.PossessionSystem
Assembly: Townskeep.dll
public interface IPossessor : IComponentExtends: IComponent
Remarks
IPossessor is the counterpart to IPossessable — together they form the two-sided contract for the Possession System. Any entity that can possess objects (e.g., a player character, an NPC) implements IPossessor to provide access to its Possessor component.
By extending IComponent, implementors inherit access to transform, gameObject, GetComponent<T>(), and other Unity component APIs — ensuring that possessors are always MonoBehaviour-backed.
The Possessor component uses this interface internally: during Awake() it calls GetComponent<IPossessor>() to discover its owner, and stores the reference as Owner for use during possession events.
Quick Lookup
Get the Possessor from an IPossessor
iPossessor.Possessor
Possess an object
iPossessor.Possessor.Possess(possessable)
Release an object
iPossessor.Possessor.Release(possessable)
Check if possessing
iPossessor.Possessor.IsPossessing(possessable)
Properties
Possessor
The Possessor component that manages this entity's possessions. Returns the concrete component instance, providing access to Possess(), Release(), TryGetPossession<T>(), and possession events.
Implementation Requirements
When implementing, you MUST:
Have a
Possessorcomponent on the same GameObjectReturn it from the
Possessorproperty
You SHOULD:
Cache the
Possessorreference inAwake()viaGetComponent<Possessor>()Implement the property as a simple getter returning the cached field
Common Pitfalls
Possessor component required
The implementing MonoBehaviour's GameObject must have a Possessor component. The Possessor component calls GetComponent<IPossessor>() in its own Awake() — if no implementor is found, the owner reference will be null.
Examples
Implementing IPossessor
Using IPossessor to check possessions
See Also
Possessor — the component that manages possession state
IPossessable — the counterpart interface for objects that can be possessed
IComponent — base interface providing Unity component access
Last updated