Find choosen EndPoint from MultiTargetPath

Hi.

I am using MultiTargetPath to find path from array of end points.

Code i have used is :

        MultiTargetPath multiplePath = MultiTargetPath.Construct (startPos, targetEndPosition, null, null);
	multiplePath.pathsForAll = false;
	seeker.StartMultiTargetPath (multiplePath); 

Now i want to find endpoint from the choosen path. I have tried endNode , endPoint but its not giving me correct position.

What can be the reason ?

Hi

Iā€™m pretty sure just multiplePath.endPoint would work.
Otherwise the integer field chosenTarget indicates the index of the shortest path, and you can get the end point of that path using multiplePath.targetPoints[multiplePath.chosenTarget].

1 Like

Note that you have to wait for the path to be calculated before the info will be there (e.g by running that code in the OnPathComplete callback).