Struct AgentManagedRef Extends ICleanupComponentData

Public

Handle to an agent's managed data.

Agents need to store some data that cannot live in an unmanaged component, such as the agent's current path and its traversal provider. That data lives in AgentManagedStorage, and this component is the agent's handle to it.

This is a cleanup component, which gives it two properties that the whole design rests on:

  • It is never copied when an entity is cloned. A clone starts out without it, and only gains it once AgentManagedDataRepairSystem has given the clone its own copy of the data. Until then the clone is not a usable agent, and its lack of this component is what keeps it out of every query.

  • It survives entity destruction, so AgentManagedDataCleanupSystem can still reach the slot and release the agent's data after the entity is destroyed.

Guarantee: an entity that has this component owns the slot it holds. Queries that require this component can read the slot without any further ownership check.

Private/Protected Members

slot

Index into AgentManagedStorage.

Internal