A* Pathfinding Project  4.1.7
The A* Pathfinding Project for Unity 3D

This example shows how to use a MultiTargetPath using the Seeker::StartMultiTargetPath function.This script should be attached to any GameObject with children and a Seeker component.
This example is only valid when the pathsForAll parameter is set to true, if it is set to false, you can get the path info in the same way as a standard path.

Tested in the A* Pathfinding Project 3.0.7
A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here
public class MultiTargetPathExample : MonoBehaviour {
// Use this for initialization
void Start () {
//Find the Seeker component
Seeker seeker = GetComponent<Seeker>();
//Make sure all OnComplete calls are called to the OnPathComplete function
seeker.pathCallback = OnPathComplete;
//Set the target points to all children of this GameObject
Vector3[] endPoints = new Vector3[transform.childCount];
int c = 0;
foreach (Transform child in transform) {
endPoints[c] = child.position;
//Start a multi target path
seeker.StartMultiTargetPath(transform.position, endPoints, true);
/* Alternative - Create a MultiTargetPath from scratch instead
* MultiTargetPath p = new MultiTargetPath (transform.position,endPoints,null,null);
* seeker.StartMultiTargetPath (p);
public void OnPathComplete (Path p) {
Debug.Log("Got Callback");
if (p.error) {
Debug.Log("Ouch, the path returned an error\nError: "+p.errorLog);
MultiTargetPath mp = p as MultiTargetPath;
if (mp == null) {
Debug.LogError("The Path was no MultiTargetPath");
//All paths
List<Vector3>[] paths = mp.vectorPaths;
for (int i = 0; i < paths.Length; i++) {
//Plotting path i
List<Vector3> path = paths[i];
if (path == null) {
Debug.Log("Path number "+i+" could not be found");
for (int j = 0; j < path.Count-1; j++) {
//Plot segment j to j+1 with a nice color got from Pathfinding.AstarMath.IntToColor
Debug.DrawLine(path[j], path[j+1], AstarMath.IntToColor(i, 0.5F));