Possession

A bidirectional control framework where a Possessor (e.g., a Player) takes control of a Possessable (e.g., a Character). Both sides maintain event-driven hooks and configurable PossessAction callbacks, with spatial coupling handled via transform reparenting.

Architecture

spinner

Data Flow

spinner

Key Concepts

Concept
Description

Possessor

The controlling entity (has a Possessor component + implements IPossessor)

Possessable

The controlled entity (has a Possessable component + implements IPossessable)

PossessAction

Abstract action hook — both sides have serialized possessAction / releaseAction fields for custom behavior

Spatial coupling

The possessable is parented under the possessor; LateUpdate keeps positions in sync

Multi-possession

A Possessor can possess multiple Possessable entities simultaneously

Extension methods

PossessorExtensions / PossessableExtensions bridge IPossessor/IPossessable interfaces to the underlying components

Quick Start

Making an entity possessable

  1. Add a Possessable component to the GameObject

  2. Implement IPossessable on a sibling component (e.g., Character)

  3. Optionally assign PossessAction assets for custom possess/release behavior

Making an entity a possessor

  1. Add a Possessor component to the GameObject

  2. Implement IPossessor on a sibling component (e.g., Player)

  3. Call possessor.Possess(possessable) to take control

Using extension methods

Classes

Class
Description

Component for entities that can possess — manages possession list and events

Component for entities that can be possessed — manages state and spatial coupling

See Also

  • Player — a concrete IPossessor implementation

  • Character — a concrete IPossessable implementation

Last updated