Skip to content

Game.Vehicles.Airplane

Assembly: Assembly-CSharp
Namespace: Game.Vehicles

Type: struct Airplane

Base: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
Airplane is an empty/tag component used by the game's ECS to mark or identify airplane-type vehicle entities. It is defined as a value-type with an explicit layout ([StructLayout(LayoutKind.Sequential, Size = 1)]) so it has a non-zero size for native containers and serialization. The implementation of Colossal.Serialization.Entities.IEmptySerializable indicates the type should be treated as an empty/marker component for the game's serialization system.


Fields

  • None
    This struct contains no instance fields. It is a marker/tag component — its presence on an entity is the information.

Properties

  • None
    There are no properties defined for this type.

Constructors

  • public Airplane()
    The parameterless constructor is the implicit default for value types; no custom construction logic is provided.

Methods

  • None
    No methods are defined. The type's purpose is purely to act as a marker for ECS queries and logic.

Usage Example

using Unity.Entities;
using Game.Vehicles;

// Add the tag to an existing entity
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity airplaneEntity = em.CreateEntity();
em.AddComponentData(airplaneEntity, new Airplane());

// Query for airplane entities inside a SystemBase
public partial class AirplaneSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // This will iterate over entities that have the Airplane tag
        Entities
            .WithAll<Airplane>()
            .ForEach((Entity entity) =>
            {
                // Handle airplane-specific logic here
            })
            .ScheduleParallel();
    }
}

Notes: - The StructLayout attribute (Size = 1) ensures the type occupies at least one byte in memory, avoiding zero-sized-type issues when used in native containers or when interacting with low-level serialization. - Implementing IEmptySerializable informs the Colossal/CS2 serialization system that this component has no serializable fields and should be handled as an empty marker during save/load operations.