Skip to content

Game.Buildings.ResearchFacility

Assembly:
Game (assembly containing game types — actual assembly name may vary in the mod/game build)

Namespace:
Game.Buildings

Type:
struct

Base:
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable

Summary: ResearchFacility is an empty/tag component used by the ECS to mark entities that represent research facilities. It carries no payload; its presence on an entity is used to include that entity in queries or systems that operate on research facilities. The type is annotated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure it has a non-zero managed size for serialization/marshalling and compatibility with the Colossal serialization pipeline.


Fields

  • // none
    This struct declares no instance fields. It is intentionally empty and used as a marker/tag component.

Properties

  • // none
    There are no properties on this type.

Constructors

  • public ResearchFacility()
    No explicit constructors are declared in the source. As a value type, it has the default parameterless constructor supplied by the runtime; you generally create instances with new ResearchFacility() or using the default literal default(ResearchFacility).

Methods

  • // none
    This type defines no methods. Its behavior is entirely as a marker for ECS queries and serialization.

Notes on Attributes & Interfaces

  • [StructLayout(LayoutKind.Sequential, Size = 1)]: Ensures the struct occupies one byte in memory layout. This is useful to avoid zero-sized struct problems when passing to native code or serialization systems.
  • IComponentData: Marks this as a Unity ECS component type.
  • IQueryTypeParameter: Allows usage in generic query APIs as a type parameter (used by Unity.Entities query utilities).
  • IEmptySerializable: Indicates compatibility with Colossal.Serialization.Entities for entity/component serialization used by Cities: Skylines 2.

Usage Example

// Add the marker component to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
// Add the tag component (no payload)
entityManager.AddComponentData(entity, new ResearchFacility());

// Querying entities with the tag in a system (example)
Entities
    .WithAll<ResearchFacility>()
    .ForEach((Entity e) =>
    {
        // operate on research facility entities
    }).Schedule();