Skip to content

Game.Buildings.RoadConnectionUpdated

Assembly:
Likely the game's main assembly (e.g. Assembly-CSharp) — not specified in the source file.

Namespace: Game.Buildings

Type: struct

Base: Implements Unity.Entities.IComponentData and Unity.Entities.IQueryTypeParameter

Summary: A small plain-data component used to signal that a building's road connection changed. It carries references to the building entity and the old/new connected road entities. Because it implements IComponentData it can be attached to entities; implementing IQueryTypeParameter makes it usable as a query parameter in Unity.Entities queries. This struct is a simple, blittable container intended for use in ECS systems that react to road-connection updates for buildings.


Fields

  • public Entity m_Building This is the Entity representing the building whose road connection was updated. Typically the component will be attached to this building entity or used in a query that includes it.

  • public Entity m_Old Entity reference to the previously connected road (or Entity.Null if there was no previous connection).

  • public Entity m_New Entity reference to the newly connected road (or Entity.Null if the connection was removed).

Properties

  • This type defines no properties. It only exposes public fields.

Constructors

  • public RoadConnectionUpdated() Structs in C# have a default parameterless constructor provided by the runtime which initializes fields to their default values (Entity fields default to Entity.Null). No explicit constructor is defined in the source.

Methods

  • This type defines no methods. It is purely a data container (IComponentData / IQueryTypeParameter).

Usage Example

// Create and attach the component to a building entity:
var update = new RoadConnectionUpdated
{
    m_Building = buildingEntity,
    m_Old = oldRoadEntity,
    m_New = newRoadEntity
};
EntityManager.AddComponentData(buildingEntity, update);

// Example SystemBase usage: react to road-connection updates
public partial class RoadConnectionSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Iterate over entities that have the RoadConnectionUpdated component.
        Entities
            .ForEach((in RoadConnectionUpdated update) =>
            {
                // handle the update: update visuals, recalc routing, etc.
                // update.m_Building, update.m_Old, update.m_New are available here
            })
            .Schedule();
    }
}

Notes: - Because this is an IComponentData, prefer using ECS-safe APIs (EntityManager/Systems) to add/remove/read it. - The meaning of m_Old or m_New being Entity.Null should be handled (e.g., connection removed or newly established).