I’m currently loading random level modules as needed, and then translating/rotating them to match up with an exit point on a previously loaded level piece, and so on and so forth. Everything works great so far in that I’m pre-scanning the graphs, saving them as bytes, loading additively at runtime as needed and then relocating the nodes along with their associated game objects and geometry, BUT I’m not sure how to actually connect the exit node from one graph to the entry node of its neighboring graph such that the connection is traversable.
What are my options here? Preferably I’d like to keep the graphs as separate graphs, so it’s easier to clean them up as old level modules are destroyed, but I’m open to anything. Hopefully the A* Pathfinding Project supports something like this in one way or another.
Also, on the topic of multiple Recast Graphs: NavmeshCut objects only appear to actually cut one of my multiple Recast Graphs (the original/first in the list?) when I want them to cut all graphs. These seem like related tasks, so I thought I’d mention it.
EDIT: It appears that my additively deserialized Recast Graphs don’t have their associated single containing tile, and aren’t affected by the TileHandlerHelper? I tested this by ditching the static starting piece and load even the initial level piece in at runtime:
EDIT2: Actually the graphs do have their single containing tile, but I still see this error.
ArgumentException: graph has no tiles. Please scan the graph before creating a TileHandler
Pathfinding.Util.TileHandler…ctor (Pathfinding.RecastGraph graph) (at Assets/AstarPathfindingProject/Generators/Utilities/TileHandler.cs:34)
Pathfinding.TileHandlerHelper.Start () (at Assets/AstarPathfindingProject/Navmesh/TileHandlerHelper.cs:64)
Will tile handlers/helpers not work at all with deserialized Recast Graphs? Looks like I need to edit TileHandlerHelper’s functionality to support a collection of handlers rather than one?
I do not recommend connecting multiple graphs, instead you can replace tiles during runtime.
I’m afraid there is not a very good API for this yet, but the main idea is to use
TileHandler.LoadTile (TileType tile, int x, int z, int rotation, int yoffset)
You can create tile types using
Currently that API call does not return the tile types, it just stores them internally, but you can easily modify that to return them.
Doing this will also make it work with the TileHandlerHelper just fine (provided it uses the same TileHandler instance as you call LoadTile on).