Game.Vehicles.PrisonerTransport
Assembly:
Game
Namespace:
Game.Vehicles
Type:
struct
Base:
System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable)
Summary:
PrisonerTransport is an empty/tag ECS component used to mark vehicle entities that are transporting prisoners. It contains no runtime data — the presence of the component on an entity is used by systems and queries to identify prisoner transport vehicles. The type is attributed for a fixed, non-zero layout to ensure compatibility with the game's serialization and native interop systems.
Fields
- This struct defines no instance fields. It is an intentionally empty/tag component.
Additional notes: - The type is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to guarantee a 1-byte size and sequential layout. That avoids zero-sized type edge cases in native serialization and ensures compatibility with Colossal's serialization pipeline.
Properties
- This struct exposes no properties. Its behavior is solely determined by the presence/absence of the component on an entity.
Constructors
public PrisonerTransport()
(implicit default)
As an empty value-type, the default parameterless constructor is provided implicitly. Use the default value when adding the component to an entity.
Methods
- This struct declares no methods. It acts only as a marker/tag component.
Remarks on Interfaces
- IComponentData — Marks the type as an ECS component usable with Unity's DOTS/Entities systems.
- IQueryTypeParameter — Allows the type to be used as a query parameter (e.g., WithAll
()). - IEmptySerializable — Used by Colossal.Serialization.Entities to indicate the type can be serialized even though it has no data.
Usage Example
// Add the tag to an existing entity (EntityManager API)
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponent<PrisonerTransport>(vehicleEntity);
// Or using AddComponentData with the default value
entityManager.AddComponentData(vehicleEntity, new PrisonerTransport());
// Querying for prisoner transport vehicles in a system
Entities
.WithAll<PrisonerTransport>()
.ForEach((Entity vehicleEntity) =>
{
// This code runs for entities marked as prisoner transport vehicles
})
.Schedule();