Skip to content

Game.Prefabs.TransformerData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable)

Summary:
TransformerData is an empty marker/tag component used by the game's ECS and serialization systems to mark entities that represent transformer prefabs. It carries no runtime payload (no fields) and exists so systems and queries can identify transformer entities efficiently. The type is attributed with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure a defined, minimal size for interop/serialization and to satisfy the game's custom serialization expectations (IEmptySerializable).


Fields

  • This type declares no instance fields. It is an empty (tag) struct.

Properties

  • This type defines no properties.

Constructors

  • public TransformerData() (implicit default struct constructor)
    This struct uses the default value-type constructor. Since it contains no data, constructing it yields an empty marker instance.

Methods

  • This type declares no methods. Behavior is provided by implementing interfaces (IComponentData for ECS membership, IQueryTypeParameter for use in queries, and IEmptySerializable for Colossal's serialization pipeline), but there are no explicit members defined on the struct itself.

Usage Example

// Add the tag to an entity (EntityManager API)
entityManager.AddComponentData(entity, new Game.Prefabs.TransformerData());

// Create a query for all transformer-tagged entities
var transformerQuery = entityManager.CreateEntityQuery(typeof(Game.Prefabs.TransformerData));

// In a SystemBase using Entities.ForEach, select entities that have the tag
Entities
    .WithAll<Game.Prefabs.TransformerData>()
    .ForEach((Entity e) =>
    {
        // operate on transformer entities
    })
    .Schedule();

Additional notes: - Because TransformerData implements IEmptySerializable, the Colossal serialization framework treats it as a serializable marker with no payload — useful for save/load and prefab serialization in Cities: Skylines 2 modding. - Use this component when you need to identify or filter transformer-prefab entities without attaching extra data.