Skip to content

Game.Pathfind.CoverageUpdated

Assembly:
{{ Likely part of the main game assembly for Cities: Skylines 2 mod code (exact assembly name not present in source). }}

Namespace: Game.Pathfind

Type:
struct

Base:
IComponentData, IQueryTypeParameter

Summary:
Represents an ECS component that carries a "coverage updated" event for the pathfinding system. This struct packages the owner Entity and associated PathEventData so that systems can query for or process path coverage update events. Implementing IQueryTypeParameter indicates it can be used as a query parameter type in ECS queries.


Fields

  • public Entity m_Owner
    Holds the Entity that owns or originated the coverage update event. Typically used to identify which object (e.g., vehicle, pedestrian, or manager entity) the PathEventData is associated with.

  • public PathEventData m_Data
    Contains the payload for the coverage update event. PathEventData is not defined in this file, but it is expected to hold details about the pathfinding event (such as node/segment information, flags, timestamps, or other event-specific data).

Properties

  • None.
    This type exposes two public fields and does not define any C# properties.

Constructors

  • public CoverageUpdated(Entity owner, PathEventData data)
    Initializes a new CoverageUpdated instance with the specified owner Entity and PathEventData payload.

Methods

  • None.
    This is a plain data component/marker; it contains no methods beyond the constructor.

Usage Example

using Unity.Entities;
using Game.Pathfind;

// Example: create and attach a CoverageUpdated component to an entity
public void RaiseCoverageUpdated(EntityManager entityManager, Entity owner, PathEventData data)
{
    var coverage = new CoverageUpdated(owner, data);

    // If the entity already has this component type, set it; otherwise add it.
    if (entityManager.HasComponent<CoverageUpdated>(owner))
    {
        entityManager.SetComponentData(owner, coverage);
    }
    else
    {
        entityManager.AddComponentData(owner, coverage);
    }
}

// Example usage in a system query (pseudo-code):
// Entities.ForEach((ref CoverageUpdated evt) => { /* process evt.m_Data for evt.m_Owner */ });

{{ Additional notes: - Because CoverageUpdated is a struct implementing IComponentData, it's intended to be stored directly in entity component storage and is suitable for high-performance ECS usage (assuming PathEventData is blittable). - As an event-style component it may be added/removed in a single frame to signal one-shot events; consider using entity command buffers in multi-threaded systems to add/remove this component safely. - If you need to broadcast multiple coverage update events per frame, prefer using dynamic buffers or separate event queues rather than repeatedly mutating a single component instance. }}