What is the preferred method for referencing graphs

Is one of these methods preferred over the other? Wondering about performance and if the second method may be deprecated in the future.

nearestGraphPos = AstarPath.active.GetNearest(myPosition, myConstraint)).position
nearestGraphPos = myGraph.GetNearest(myPosition).clampedPosition

  • myConstraint is set to restrict it to the graph in use.

So it appears that constraints are used by AstarPath.active but are ignored in any functions when used with a graph reference. Different use cases then. Does this sound right?


nearestGraphPos = AstarPath.active.GetNearest(myPosition, myConstraint).position

Is preferred, though for most graph types they will do pretty much the same thing.