Legacy Documentation: Version 2018.1 (Go to current version)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



public var corners: Vector3[];
public Vector3[] corners;


Corner points of the path. (Read Only)

Also known as "waypoints", the corners define the places along a path where it changes direction (ie, the path consists of a number of straight-line moves between corners).

// Calculate the length of a NavMeshPath. A character will
// typically move a slightly longer distance than this as a
// result of its steering behaviour.
function PathLength(path: AI.NavMeshPath) {
    // The length is implicitly zero if there aren't at least
    // two corners in the path.
    if (path.corners.Length < 2)
        return 0;

var previousCorner = path.corners[0]; var lengthSoFar = 0.0;

// Calculate the total distance by adding up the lengths // of the straight lines between corners. for (var i = 1; i < path.corners.Length; i++) { var currentCorner = path.corners[i]; lengthSoFar += Vector3.Distance(previousCorner, currentCorner); previousCorner = currentCorner; }

return lengthSoFar; }
no example available in C#

Did you find this page useful? Please give it a rating: