Hi,
I have 2 graphs, where the first one is a navmesh graph and the second one is a point graph.
Im trying to initialize the point graph with nodes in runtime like this, but later end up with 0 nodes:
AstarPath.RegisterSafeUpdate(delegate ()
{
// Safe to modify graph data here
var graph = AstarPath.active.graphs[1] as PointGraph;
Int3 pos1 = new Int3() { x = 0, y = 5, z = 0 };
Int3 pos2 = new Int3() { x = 50, y = 5, z = 50 };
graph.AddNode(pos1);
graph.AddNode(pos2);
PointNode pn1 = graph.nodes[graph.CountNodes() - 2];
PointNode pn2 = graph.nodes[graph.CountNodes() - 1];
pn1.AddConnection(pn2, 0);
pn2.AddConnection(pn1, 0);
AstarPath.OnGraphPostScan += temp =>
{
if (temp.graphIndex == 1)
{
Debug.Log("Nodes in graph: " + graph.nodeCount);
}
};
AstarPath.active.Scan();
});
Also, how can i scan only the point graph?