A* Pathfinding Project  3.1.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Enumerations Properties Groups Pages
MovePointNode.cs

Moves and updates a single node in a point graph.If you want to move a single node in a point graph, you might be lost in how to do that in the "correct" way. Would you only update a node's position field, the node would be moved, however all connections would remain even if some might be invalid and no connection costs will have been recalculated to reflect the new position. For that reason this example script is put here. It simply picks a random node (closest node from within a sphere, so not really random) and moves it in a random direction a small distance.

Since
This script requires version 3.2.
using UnityEngine;
using System.Collections;
using Pathfinding;
public class MovePointNode : MonoBehaviour {
// Update is called once per frame
void Update () {
//Get a random node to update
Node node = AstarPath.active.GetNearest (Random.insideUnitSphere*20).node;
//Move the node a bit
node.position += (Int3)(Random.insideUnitSphere*0.1f);
//Recalculate the area around the node.
//No functions for updating a single node is available, so we create
//a bounds object which contains that node and only a small volume around it
AstarPath.active.UpdateGraphs (new GraphUpdateObject (new Bounds ((Vector3)node.position,new Vector3(0.1f,0.1f,0.1f))));
//Make sure the above graph update is done now
//The update area functions of the built-in graphs generally assumes that the position of the node
//has not changed, so some connection costs might be wrong
node.RecalculateConnectionCosts (true);
}, true);
//If you want to make sure the update is called directly instead of
//at the end of this frame or after a few frames.
//AstarPath.active.FlushThreadSafeCallbacks ();
}
}