Skip to content

Game.Prefabs.WarehouseData

Assembly: Game (inferred from project path; actual assembly name may vary)
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
WarehouseData is an empty/marker ECS component (value type) used to tag entities related to warehouse prefabs. It has an explicit StructLayout with Size = 1 to ensure the type is non-zero-sized for serialization and runtime compatibility (Colossal.Serialization / Unity ECS). As a marker component it carries no data but is used for entity queries, archetype composition, and to signal serialization behavior via IEmptySerializable.


Fields

  • (none)
    This struct intentionally contains no fields. The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute ensures it occupies one byte to avoid zero-sized-type issues when serializing or interacting with systems that expect a non-zero size.

Properties

  • (none)

Constructors

  • public WarehouseData()
    Implicit default parameterless constructor (value-type default). Use of the struct does not require initialization beyond the default.

Methods

  • (none declared)
    Implements marker interfaces:
  • IComponentData: marks the type as a Unity ECS component.
  • IQueryTypeParameter: enables use in query type parameters (e.g., for CreateEntityQuery).
  • IEmptySerializable: indicates the type is treated as an "empty" serializable component by Colossal/Unity serialization systems.

Usage Example

// Add the marker component to an existing entity (EntityManager)
entityManager.AddComponent<WarehouseData>(entity);

// Or using AddComponentData (works with value types)
entityManager.AddComponentData(entity, new WarehouseData());

// Create a query that finds all entities flagged as warehouses
var warehouseQuery = entityManager.CreateEntityQuery(
    ComponentType.ReadOnly<WarehouseData>()
);

// Use in archetype creation to tag newly created entities as warehouses
var archetype = entityManager.CreateArchetype(
    typeof(WarehouseData),
    typeof(SomeOtherComponent)
);
var warehouseEntity = entityManager.CreateEntity(archetype);

Notes: - The StructLayout(Size = 1) attribute is important to avoid issues with zero-sized components in some serialization or engine systems; keep it if the component must be serialized or used with Colossal.Serialization. - As a marker component it is intended only for tagging/querying; add fields or create a different struct if you need to store per-entity warehouse data.