A* Pathfinding Project
4.3.4
The A* Pathfinding Project for Unity 3D
|
How to make edits to the graph structure.
Sometimes the graph is almost right, but there are maybe some cases where you need it fixed up a bit. This is most common with the point graph and this page is mostly intended for that graph type. The methods do work for other graph types as well to some extent however.
If you have a point graph where you want to either add a connection, remove an existing connection or perhaps change the cost of some connection then you can use the NodeLink component. Point graphs are generally created from a collection of GameObjects. You can add the NodeLink component to one node and then set the target to another node. By changing the options the component can then either add a new connection between those two nodes, remove an already existing connection (if one exists) or change the cost of the connection between them. These new connections are identical to the ones created by the point graph originally.
To make it easier to modify the graph there are some keyboard shortcuts. You can find the menu items in Unity under menubar -> Edit -> Pathfinding.
You can also modify graph connections using code.