Game.Vehicles.Controller
Assembly:
Assembly-CSharp (typical runtime assembly for game/mod code)
Namespace:
Game.Vehicles
Type:
struct
Base:
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary:
A lightweight ECS component that stores a reference to a controller Entity. Intended to be attached to vehicle-related entities to link them with their controller entity (for example a driver/controller object). The component is plain data (IComponentData) and marked for the game's serialization system via IEmptySerializable.
Fields
public Unity.Entities.Entity m_Controller
Holds the Entity handle of the controller associated with the entity this component is attached to. This field is public and can be read or written by systems and jobs operating on the ECS world.
Properties
- (none)
This struct exposes no C# properties — only the public field m_Controller.
Constructors
public Controller(Unity.Entities.Entity controller)
Initializes a new Controller component instance, setting m_Controller to the provided Entity. Useful for constructing the component inline when adding it to an entity.
Methods
- (none)
No methods are defined on this struct. Behavior is provided by systems that read or write this component. The implemented interfaces are marker/contract interfaces used by the ECS and serialization systems.
Usage Example
// Using an EntityManager to attach the component to an existing vehicle entity
Entity controllerEntity = /* obtain or create controller entity */;
Entity vehicleEntity = /* existing vehicle entity */;
var controllerComp = new Game.Vehicles.Controller(controllerEntity);
entityManager.AddComponentData(vehicleEntity, controllerComp);
// Using an EntityCommandBuffer (e.g., during structural changes in a job/system)
var controllerComp2 = new Game.Vehicles.Controller(controllerEntity);
entityCommandBuffer.AddComponent(vehicleEntity, controllerComp2);
Additional notes: - Because this is IComponentData, it is intended to be used in ECS queries and in Jobs. Treat the Entity field as an opaque handle — resolve it through EntityManager or relevant systems when needed. - IEmptySerializable indicates participation in the Colossal serialization pipeline without custom serialized payload beyond the struct's fields.