Function PointGraph.RemoveNode
void RemoveNode (
node |
Removes a node from the graph.
// Make sure we only modify the graph when all pathfinding threads are paused
AstarPath.active.AddWorkItem(() => {
// Find the node closest to some point
var nearest = AstarPath.active.GetNearest(new Vector3(1, 2, 3));
// Check if it is a PointNode
if (nearest.node is PointNode pnode) {
// Remove the node. Assuming it belongs to the first point graph in the scene
AstarPath.active.data.pointGraph.RemoveNode(pnode);
}
});
Note
For larger graphs, this operation can be slow, as it is linear in the number of nodes in the graph.