Hello. First, your asset is very helpful for me. Thanks!
I am developing Real-time RPG game, so I make A* Gridgrapgh on scene.
But, map on game is very huge, then can`t cover all map at one A* Gridgrapgh.
So, I thought that ‘I change A* Gridgrapgh position and rescan in runtime’, but I can`t.
I read http://arongranberg.com/vanillaforums/discussion/1180/rescale-grid-graph-during-run-time/p1, and http://arongranberg.com/astar/docs/class_pathfinding_1_1_grid_graph.php. But, scanned graph in runtime is empty.
Below is my script.
GameObject A;
AstarPath astar;
Pathfinding.AstarData data;
Pathfinding.GridGraph gg;
// Use this for initialization
void Awake () {
GameObject A = GameObject.Find ("A*");
astar = A.GetComponent("AstarPath") as AstarPath;
data = AstarPath.active.astarData;
gg = data.AddGraph(typeof(Pathfinding.GridGraph)) as Pathfinding.GridGraph;
gg.width = 10;
gg.depth = 10;
gg.nodeSize = 0.25f;
gg.rotation = new Vector3 (90f, 0f, 0f);
gg.UpdateSizeFromWidthDepth();
}
void Rescan () {
gg.center = transform.position; // transform.position is player transform.position.
AstarPath.active.Scan();
}
Thanks.