Hi,
I’m procedurally generating a 2D tilemap and want to scan the graph after having done that.
However, it doesn’t quite appear to work.
I’m using AstarPath.active.Scan()
after having generated the tilemap, however, it shows the entire map as blue. If I then simply hit the scan button in the unity editor, it does what I expected.
Should I not be able to simply scan from script?
My grid graph has been set up in the editor, and I’m I just set the size and ask it to scan, in my script.
Code:
void GeneratePathGraph(int width, int height)
{
// get graph
var gg = AstarPath.active.data.gridGraph;
float nodeSize = 0.5f;
gg.center = new Vector3(width / 2f, height / 2f, 0);
// Updates internal size from the above values
gg.SetDimensions(width * 2, height * 2, nodeSize);
// Scans graph
AstarPath.active.Scan(gg);
}