A* project separated graphs to prefabs

Hi all
In my project I have a set of separate Zones (defined in prefabs) that are added to the scene procedurally. Such Zones are connected with each other through “teleports”. For each Zone I would like to specify a graph (in prefab editor) and on Awake add the graph to AstarPath script (which is supposed to be singleton). When AI agent is in the zone (it knows which zone it is in) and do path finding only on that zone’s graph. I have found that seeker script can specify which graph to use, but I dont see any way to handle graph management in the way I described. Is that doable at all?

Got some ideas from Create a graph dynamically
Will try them out asap.

I cant find where do you set programmatically that GridGraph is 2D?

Hi

Sorry for the late reply, I have been away for some time.

You can make the graph a 2D graph by settings its rotation:

gridGraph.rotation = new Vector3(-90, 270, 90);

This is basicly what I ended up doing, but I wasn’t sure if that is correct approach. But thanks :slight_smile:

1 Like