Skip to content

Game.Vehicles.ParkMaintenanceVehicle

Assembly: Assembly-CSharp (inferred)
Namespace: Game.Vehicles

Type: struct

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
ParkMaintenanceVehicle is a zero/empty tag component used by the ECS to mark entities that represent park maintenance vehicles. The type is a struct with a fixed layout ([StructLayout(LayoutKind.Sequential, Size = 1)]) so it has a stable, non-zero size for serialization and interop. Implementing IComponentData makes it usable as an ECS component; IQueryTypeParameter allows it to participate in query type parameters; IEmptySerializable indicates to the game's serialization system that this is an empty/marker component with special serialization behavior.


Fields

  • This struct declares no instance fields.
    ParkMaintenanceVehicle is intentionally empty (a tag component). The StructLayout attribute with Size = 1 ensures a minimal non-zero size for runtime/serialization systems that require it.

Properties

  • None.
    (This type does not expose any properties — it exists solely as a marker component.)

Constructors

  • Default parameterless struct constructor (implicit).
    (There is no explicit constructor in code; you can create it with new ParkMaintenanceVehicle() if needed.)

Methods

  • None.
    (No methods are defined — use it only as a tag.)

Usage Example

using Unity.Entities;
using Game.Vehicles;

// Add the tag to an entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity vehicleEntity = /* obtain or create entity */;
entityManager.AddComponentData(vehicleEntity, new ParkMaintenanceVehicle());

// Check if an entity has the tag
bool isParkMaintenance = entityManager.HasComponent<ParkMaintenanceVehicle>(vehicleEntity);

// Create a query to find all park maintenance vehicles
EntityQuery query = entityManager.CreateEntityQuery(typeof(ParkMaintenanceVehicle));
using (var entities = query.ToEntityArray(Unity.Collections.Allocator.TempJob))
{
    foreach (var e in entities)
    {
        // process e as a park maintenance vehicle
    }
}

Additional notes: - Because this is an empty/tag component, prefer AddComponentData/HasComponent or entity queries rather than storing data on the component. - The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute is used to ensure the struct has a defined size (1 byte) for serialization/interop purposes — this is common for marker types that must be recognized by custom serializers (e.g., Colossal.Serialization). - IEmptySerializable is specific to the game's serialization helpers; it indicates the component can be handled by the engine's empty-component serialization path.