Skip to content

Game.Buildings.StorageProperty

Assembly: Assembly-CSharp
Namespace: Game.Buildings

Type: struct

Base: System.ValueType, Game.Buildings.StorageProperty implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable

Summary: StorageProperty is an empty/tag component used by the ECS (Unity.Entities) to mark entities related to building storage. It is laid out with a fixed Size of 1 byte (StructLayout(LayoutKind.Sequential, Size = 1)) so it remains serializable and has a non-zero size for the Colossal serialization system. Because it implements IComponentData and IQueryTypeParameter it can be used in entity queries and job parameters; implementing IEmptySerializable indicates it participates correctly in the game's custom serialization pipeline.


Fields

  • (none)
    This struct contains no fields; it is used purely as a marker/tag component.

Properties

  • (none)
    No properties are provided. Treat this type as a stateless marker.

Constructors

  • (implicit) public StorageProperty()
    The default parameterless constructor is the only constructor (implicit for structs). No runtime initialization is required.

Methods

  • (none)
    There are no methods defined on this struct. All behavior is implied by presence/absence of the component on an entity.

Notes and Implementation Details

  • The attribute [StructLayout(LayoutKind.Sequential, Size = 1)] forces the struct to occupy a non-zero size of 1 byte. This is useful for certain serialization and interop scenarios (and is required by some parts of the game's serialization to treat components as present).
  • Implements Unity.Entities.IQueryTypeParameter so it can be used in queries and job signatures (e.g., as a WithAll filter).
  • Implements Colossal.Serialization.Entities.IEmptySerializable indicating compatibility with the game's custom serialization system for empty components/tags.
  • Because this is a marker component, do not add mutable state here; add separate components if you need to store data.

Usage Example

// Add the tag component to an entity
entityManager.AddComponentData(entity, new Game.Buildings.StorageProperty());

// Alternatively (where supported), add the component as a tag
entityManager.AddComponent<Game.Buildings.StorageProperty>(entity);

// Query entities that have the StorageProperty tag
Entities
    .WithAll<Game.Buildings.StorageProperty>()
    .ForEach((Entity e, ref SomeOtherComponent comp) =>
    {
        // Operate on entities that are "storage" buildings
    }).Schedule();

Additional tip: because StorageProperty is empty, queries that use WithAll() are efficient and appropriate for filtering entities without carrying extra memory per-entity (beyond the 1 byte layout used for serialization compatibility).