Upgrade Question - TileHandler.CreateTileTypesFromGraph

  • A* version: [5.3.3]
  • Unity version: [6000.0.40f1]

I am in the process of upgrading from 4.2.18 to 5.3.3. I had a few minor customisations and for one of them I am struggling to work out how to apply in 5.3.3.

I have a large open world environment. I have a recast graph that is a fixed size and I have a floating origin, I manage what graphs to load/unload in the recast graph based on the origin and position in the world. I use the NavmeshBase.ReplaceTile method for this.

In 4.2.18, I added a method to NavmeshBase, to call navmeshUpdateData.handler.CreateTileTypesFromGraph(), this is the method in the TileHandler class. I called this method after replacing tiles. This would lock in the changes to the recast graph. Otherwise the previously loaded graphs would get restored over the top of the newly replaced graphs tiles.

The method TileHandler.CreateTileTypesFromGraph no longer exists. And the TileHandler class is now static and very different.

Is there an alternate method available that does what TileHandler.CreateTileTypesFromGraph did in 4.2.18?

Hi

This has been replaced by data stored in NavmeshTile.preCutVertsInTileSpace (and 2 other similarly named arrays in that class).

But calling NavmeshBase.ReplaceTile handles that. It should load the new data, and apply any navmesh cuts that are present. So I don’t think you should need it.

Fyi, the new RecastGraph.Resize and RecastGraph.ReplaceTiles methods may be of interest to you.

1 Like

Thanks. The TileMeshes are great. I am currently using a custom method to serialize terrain graphs. But I can now use TileMeshes to serialize the data and save CPU when loading then just pass into RecastGraph.ReplaceTiles.

New Issue:
I have another issue where the scanned graph does not go to the top and right edge of the terrain tiles. The terrain is scanned with the adjacent terrains loaded to ensure the graph goes right to the edge. It is short 100 (in the Int3 format). My terrain tiles are 384x384. Which are then split into 5x5 graph tiles. They should all have a max value of 76800. But the tiles along the top edge have a max Z value of 76700 and along the right edge they have a max x value of 76700.

I currently get around this problem by adjusting the verts on these edges so they are at 76800 as appropriate.

These gaps are sometimes causing problems with pathfinding. But strangely, not always.

Can you recommend anything I can do to fix this?

Hi

This might have been fixed in the latest version.

It could also be that you do not have sufficient padding around your object when generating the navmesh. Check the “accounting for borders” section here: NavmeshPrefab - A* Pathfinding Project