Skip to content

Game.Pathfind.PathTarget

Assembly:
Assembly-CSharp (game assemblies for Cities: Skylines 2 mods — confirm in your build if different)

Namespace:
Game.Pathfind

Type:
struct

Base:
System.ValueType

Summary:
Represents a pathfinding target entry used by the game's pathfinding systems. Contains the target entity, the originating/entity reference, a delta value, a cost value and edge flags describing special conditions for this path target. The struct is a plain value type with public fields for straightforward, low-allocation use in performance-critical pathfinding code.


Fields

  • public Unity.Entities.Entity m_Target
    The destination target entity for this path entry. This typically represents the node or endpoint the pathfinding algorithm is considering.

  • public Unity.Entities.Entity m_Entity
    The entity associated with this path entry (for example, the entity that "owns" or requested the path or an intermediate entity tied to this target).

  • public float m_Delta
    A delta value used by the pathfinding logic. The meaning is context-specific to the pathfinding implementation (e.g., height difference, offset, or other per-target modifier).

  • public float m_Cost
    The accumulated or heuristic cost to reach this target. Used by the pathfinding algorithm when comparing and selecting paths.

  • public EdgeFlags m_Flags
    Flags that describe special conditions or properties of the edge/target (for example, restrictions, special routing rules). The first constructor initializes this to EdgeFlags.DefaultMask; the second constructor accepts explicit flags.

Properties

  • This struct exposes no managed properties — all data members are public fields for direct access.

Constructors

  • public PathTarget(Unity.Entities.Entity target, Unity.Entities.Entity entity, float delta, float cost)
    Initializes a PathTarget with the given target, entity, delta and cost. m_Flags is set to EdgeFlags.DefaultMask.

  • public PathTarget(Unity.Entities.Entity target, Unity.Entities.Entity entity, float delta, float cost, EdgeFlags flags)
    Initializes a PathTarget with explicit flags.

Methods

  • This struct defines no methods.

Usage Example

using Unity.Entities;
using Game.Pathfind;

// create using default flags
Entity target = /* obtain entity */;
Entity owner = /* obtain entity */;
var pt = new PathTarget(target, owner, delta: 1.2f, cost: 10.0f);

// create with explicit flags
var ptWithFlags = new PathTarget(target, owner, delta: 0.5f, cost: 5.0f, flags: EdgeFlags.NoPedestrians);

Additional notes: - Being a struct, PathTarget is a value type — copies are by-value and cheap for small structs like this. - Fields are public and mutable; be cautious when sharing instances across threads or jobs. - Verify the exact meaning of m_Delta and m_Cost in the surrounding pathfinding code to use them correctly.