Hi I am fairly new to this Project. Is there a way to get multiple of the same type of graph that was created in Unity? Since AstarData.active.data.gridGraph only get the first grid graph, how do you get the subsequent grid graph.
All graphs are stored in an array so you can reference the desired graph.
AStarGraph.active.graphs is the second graph.
ok i got that. But now i need to center the graph on update. Since this is consider to be NavGraph, is there a way for me to "convert’ it to a gridgraph type or is there variable/method i can use to center the graph? I know that gridGraph.center is a vairable i can use but i does not work on NavGraph.
I’m not sure what you mean by ‘center the graph on update’. Is offset what you’re after? This allows you to modify the position of the graph. You can also rescan the graph to make sure that everything is correctly updated in the graph.
I’m not aware of a way to convert a navgraph to a gridgraph. It is my understanding that they work in completely different ways.
NavGraph is the base class for all graphs. If you know it’s a grid graph you can cast it
var gg = AstarPath.active.data.graphs as GridGraph;
You might also be interested in https://arongranberg.com/astar/docs/runtimegraphs.html and https://arongranberg.com/astar/docs/accessingdata.html