Skip to content

Game.Prefabs.PathfindConnectionData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
Holds a set of PathfindCosts used by the pathfinding system to evaluate connection costs between nodes for different movement modes and special connection types (spawns, takeoffs, parking, etc.). This component is designed to be attached to entities that represent pathfinding connection prefabs so the pathfinding/job systems can read cost values for route calculations.


Fields

  • public PathfindCosts m_BorderCost
    Cost values applied when traversing a border connection (e.g., crossing tile/segment borders). Used by pathfinding to discourage or prefer border crossings.

  • public PathfindCosts m_PedestrianBorderCost
    Cost values specific to pedestrian border crossings. Allows different weighting for pedestrians vs vehicles when crossing borders.

  • public PathfindCosts m_DistanceCost
    Cost values representing the pure distance-related cost. Typically used to scale or add a distance penalty to routes.

  • public PathfindCosts m_AirwayCost
    Cost values for airway connections (air routes used by planes/helicopters). Influences aerial route selection.

  • public PathfindCosts m_InsideCost
    Cost values when moving inside a prefab or internal connection (short internal links within a node/prefab).

  • public PathfindCosts m_AreaCost
    Cost values for traversing area-type connections (large-area traversal, plazas, or non-linear areas).

  • public PathfindCosts m_CarSpawnCost
    Cost values used when spawning cars onto the network from this connection (influences initial route choice or spawn penalties).

  • public PathfindCosts m_PedestrianSpawnCost
    Cost values used when spawning pedestrians (influences where pedestrians choose to originate or enter the network).

  • public PathfindCosts m_HelicopterTakeoffCost
    Cost values applied for helicopter takeoff connections (used to evaluate helicopter route costs at takeoff points).

  • public PathfindCosts m_AirplaneTakeoffCost
    Cost values applied for airplane takeoff connections (used in airplane routing and takeoff penalty calculations).

  • public PathfindCosts m_TaxiStartCost
    Cost values applied when a taxi begins a trip from this connection (affects taxi route selection and spawn penalties).

  • public PathfindCosts m_ParkingCost
    Cost values used to evaluate costs related to parking connections (entering/exiting parking areas, influencing route choice for parking).

Properties

  • None. This type exposes only public fields for data storage.

Constructors

  • public PathfindConnectionData()
    Struct has the default parameterless constructor provided by C#. All PathfindCosts fields will be default-initialized (typically zeroed) unless explicitly set. Prefer initializing explicitly when creating instances to ensure sensible cost values.

Methods

  • None. This is a pure data container (IComponentData) with no behavior methods.

Usage Example

// Example: create and attach a PathfindConnectionData component to an entity.
// Note: adjust PathfindCosts construction to match its actual API.

var connData = new PathfindConnectionData
{
    m_BorderCost = new PathfindCosts(/* set cost values here */),
    m_PedestrianBorderCost = new PathfindCosts(/* ... */),
    m_DistanceCost = new PathfindCosts(/* ... */),
    m_AirwayCost = new PathfindCosts(/* ... */),
    m_InsideCost = new PathfindCosts(/* ... */),
    m_AreaCost = new PathfindCosts(/* ... */),
    m_CarSpawnCost = new PathfindCosts(/* ... */),
    m_PedestrianSpawnCost = new PathfindCosts(/* ... */),
    m_HelicopterTakeoffCost = new PathfindCosts(/* ... */),
    m_AirplaneTakeoffCost = new PathfindCosts(/* ... */),
    m_TaxiStartCost = new PathfindCosts(/* ... */),
    m_ParkingCost = new PathfindCosts(/* ... */)
};

// Using Unity.Entities.EntityManager:
// entityManager.AddComponentData(entity, connData);

// As this struct implements IQueryTypeParameter, it can also be used in queries or job parameterization
// depending on the ECS/job patterns used in the mod.