Script Reference

PathResult.cs

Standard result object returned by pathfinding requests. Contains success state, path tiles, and optional failure text.

PathfindingDataResult
On this page

Overview#

PathResult is the shared response type for path requests. It keeps movement code independent from the internal details of the pathfinding implementation.

Inspector Settings#

PathResult is a data object and does not appear in the Inspector.

Public API#

PathResult.Failed(string errorMessage)

Creates a failed path result with an error message.

PathResult.Succeeded(List<TileCoord> tiles)

Creates a successful path result with a tile list.

Runtime Properties#

SuccessTrue when a valid path was found.
TilesTiles in the calculated path.
ErrorMessageFailure reason when Success is false.
TileCountNumber of tiles in the returned path.

Common Usage#

PathResult result = pathService.RequestPath(start, end);

if (!result.Success)
{
    Debug.LogWarning(result.ErrorMessage);
    return;
}