Skip to content

Game.Prefabs.OfficeBuilding

Assembly: Game
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType, IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
OfficeBuilding is an empty (tag) ECS component used to mark entities that represent office buildings. The struct is annotated with StructLayout(LayoutKind.Sequential, Size = 1) to force a 1-byte size for serialization/alignment purposes and to ensure it is treated as a non-zero-sized component by the engine's serialization systems. As an empty marker component it carries no data — systems query for its presence to apply office-specific logic (zoning, behavior, UI, stats, etc.) in Cities: Skylines 2 mod code.


Fields

  • None
    This struct declares no fields; its size is enforced via the StructLayout attribute.

Properties

  • None

Constructors

  • public OfficeBuilding()
    Structs have an implicit parameterless constructor. No runtime initialization is required for this tag component.

Methods

  • None

Usage Example

// Add the OfficeBuilding tag to an entity using the EntityManager
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity officeEntity = em.CreateEntity();
em.AddComponentData(officeEntity, new OfficeBuilding());

// Querying for office entities in a system (example using Entities.ForEach)
public partial class OfficeProcessingSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .WithAll<OfficeBuilding>() // select entities that are tagged as office buildings
            .ForEach((Entity entity, in Translation pos) =>
            {
                // Perform office-specific logic here
            }).ScheduleParallel();
    }
}

Additional notes: - Implementing IEmptySerializable indicates this component participates in the game's custom serialization pipeline as an empty/marker type. - Implementing IQueryTypeParameter allows the type to be used directly in query APIs where supported. - Keep this component empty — attach other data components (e.g., OfficeStats, EmploymentInfo) to store per-building state.