Skip to content

Game.Pathfind.AvailabilityResult

Assembly:
{{ Likely part of the main game assembly or a modding assembly for Cities: Skylines 2. Replace with the actual assembly name if known (for example, "Assembly-CSharp" or a specific mod assembly). }}

Namespace: Game.Pathfind

Type:
struct

Base:
System.ValueType

Summary:
A simple value-type container representing the availability result of a pathfinding target. It holds a reference to the target entity and a 2D availability metric (float2), which can be used to indicate availability scores, capacities, or other pair-wise availability information relevant to pathfinding logic in the game.


Fields

  • public Entity m_Target
    {{ The Entity that serves as the pathfinding target. This is an ECS (Entity Component System) Entity from Unity.Entities. It typically identifies the destination or node to which availability information applies. }}

  • public float2 m_Availability
    {{ A two-component floating-point vector (Unity.Mathematics.float2) that stores availability data for the target. The two components can represent separate availability metrics (for example, left/right lanes, two resource types, or capacity and priority). The exact meaning depends on the consuming pathfinding logic. }}

Properties

  • None
    {{ This struct defines only public fields and does not expose any C# properties. If you prefer immutability or encapsulation, consider converting fields into properties and/or adding constructors and methods. }}

Constructors

  • public AvailabilityResult()
    {{ The compiler provides a default parameterless constructor for this struct which initializes m_Target to Entity.Null and m_Availability to (0,0). You can create instances directly with new AvailabilityResult { m_Target = ..., m_Availability = new float2(x,y) }. Consider adding an explicit constructor for convenience if desired. }}

Methods

  • None
    {{ This struct contains no methods. It is intended as a lightweight POD (plain old data) used by pathfinding systems or jobs. If you need helper behavior (e.g., utility getters, validation), add methods or extension methods. }}

Usage Example

// Create an AvailabilityResult for a target entity with availability values.
var result = new Game.Pathfind.AvailabilityResult
{
    m_Target = someEntity,                        // Unity.Entities.Entity
    m_Availability = new Unity.Mathematics.float2(1.0f, 0.5f) // example metrics
};

// Example of checking availability
if (result.m_Availability.x > 0f || result.m_Availability.y > 0f)
{
    // target is considered available in some capacity
}

{{ Additional notes: - This struct is compatible with Unity's ECS and can be used inside jobs or component data containers if needed, but remember that Unity ECS has restrictions on what types can be used in certain contexts (e.g., IComponentData). - If you intend to store this as a component, consider marking it with IComponentData and ensuring it follows ECS constraints. - For clarity and maintainability, document the semantic meaning of the two float components (x and y) in the codebase where this struct is consumed. }}