How to find the exact length of a path in nodes?

I need to know the node length so I can calculate whether or not the player has enough movement points to make a move in his turn. The GetTotalLength() function does not seem to correspond perfectly to the Length calculation seen in the completed path debug.

I went through the astarpath script in search of the calculation that provided the values for the length number in the debug but no luck! If there is some way I could grab the number that appears in the debug statement when the path is successfully calculated, that would be great.

Hi

myPath.path.Count

Should be what you are looking for.
See http://arongranberg.com/astar/docs/class_pathfinding_1_1_path.php#ac76dd31632dd24f062d1949d77af84d2

1 Like