Skip to content

Game.Prefabs.BridgeData

Assembly: Assembly-CSharp (Game)
Namespace: Game.Prefabs

Type: struct

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

Summary:
BridgeData is an empty/tag component used by the game's ECS to mark or classify entities/prefabs related to bridges. It carries no payload (no fields) and exists solely as a marker for systems and queries. The StructLayout attribute (LayoutKind.Sequential, Size = 1) ensures the component occupies a non-zero size for serialization/interop. Implementing IEmptySerializable indicates it participates in the game's serialization pipeline as an intentionally empty component, and IQueryTypeParameter allows it to be used in query type parameters.


Fields

  • This struct defines no instance fields.
    BridgeData is intentionally empty — used as a tag component to identify bridge-related entities or prefabs.

Properties

  • None.
    As an empty IComponentData, BridgeData exposes no properties.

Constructors

  • public BridgeData()
    Implicit parameterless constructor generated by the compiler. No initialization is required because there are no fields.

Methods

  • None.
    No methods are defined on this type. Serialization and query behavior are provided via marker interfaces (IEmptySerializable, IQueryTypeParameter) and by the runtime's ECS/serialization systems.

Usage Example

using Unity.Entities;

// Create an entity and add the BridgeData tag
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity bridgeEntity = entityManager.CreateEntity(typeof(BridgeData));

// Or add the tag to an existing entity
entityManager.AddComponent<BridgeData>(existingEntity);

// Query for all bridge-tagged entities in a System
Entities
    .WithAll<BridgeData>()
    .ForEach((Entity e) =>
    {
        // process bridge entity
    }).Schedule();

{{ Notes: - The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute ensures a concrete size for serialization and native interop. - Use BridgeData in archetypes, queries, and systems when you need to mark or filter entities that represent bridge prefabs or bridge-related logic. - Because it's empty, BridgeData is cheap to store and ideal for boolean/tag-like semantics in ECS. }}