Navigation AI NavMesh Issue

I am trying to use Unity’s navigation AI capabilities, but am unable to generate a NavMesh using Cesium. It complains that there are more than 100,000 meshes in the scene. I am assuming it is because of all the loaded tiles. Is there a way around this or to limit the amount of meshes Cesium generates in Unity?

I don’t know why there would be 100,000 meshes in the scene. Even a very detailed scene should have on the order of a thousand meshes, not a hundred thousand. Can you please provide us with detailed instructions to reproduce the problem you’re seeing, preferably starting with the Cesium for Unity Samples project?

I followed the steps found in the Quickstart here: Cesium for Unity Quickstart – Cesium

After having the scene setup I tried to use the AI.Navigation package and use the NavMesh in my scene. When I go to bake in the NavMesh Agent menu it throws the error complaining about there being more than 100,000 meshes.


Is the error the same as this one?
RuntimeNavMeshBuilder: Ignoring source mesh because it is too large. Each mesh dimension must not exceed 100000 units.

If you’re using a NavMeshSurface, there’s a way to limit the extents of the NavMesh with a Volume (i.e. a box collider).

Yes that is the error. How do you limit using a volume??

Same here. I am using Cesium for Unity to model a specific part of the world; however once I try to put some characters and adding state machine behaviors to make them move inside the map, I have to bake the map. But adding NavMeshSurface component to Cesium3DTileset does not work (“Updating the NavMesh failed due to an excessive number of tiles”)
I think once I click bake, it tries to bake whole world! That might be the reason it throws “exceeding 100000 units”
Is there any way to limit the number of tiles to be baked? I tried to add some planes and add NavMeshSurface component to these planes and bake only them, but did not work.

I don’t know a lot about NavMeshes in Unity, but I think the “100000 units” isn’t referring to the number of tiles / meshes. It’s referring to the coordinate values of a single object covering more than 100,000 meters.

It sounds like it’s just a warning, though, and that it will simply ignore those big tiles. That’s probably fine, because only the large, distance, low-detail tiles will cover more than 100k meters. And if you’re working in a small area, you probably don’t care much about those.

But fundamentally, this idea of “baking” the navigation is flawed. The set of tiles can and will (and must!) change at runtime. Baking at Editor time is simply not a viable solution in the general case. If that’s the only option Unity provides, then this is a Unity limitation that prevents the use of its navigation system with something like 3D Tiles. Maybe in very limited use-cases you can get Cesium for Unity to load just the tiles you want, bake the navigation based on that, and it will be “good enough” even as the view-dependent level-of-detail changes. It’s going to be super error-prone, though. You might be better off manually constructing meshes to guide your navigation rather than trying to use the 3D Tiles directly.

Thanks for your reply Kevin. One of the reasons I am trying to do it using Cesium for Unity is reproducibility: so manually constructing meshes won’t work with one of my primary objectives.
But, each time I am planning to use a specific part of the world as a use case in my project. So if there is a way to limit Cesium for Unity to load only the tiles I want it could work (actually, I was expecting to do it using subscenes feature but it seems like it is not designed for that purpose).

I haven’t prototyped this myself, but you could try using the OnTileGameObjectCreated event on the Cesium3DTileset, and only applying the NavMeshSurface component if the tile’s bounds are within a certain area.

You can do this with a tile excluder:

Janine’s suggestion is good as well. That way you can avoid doing navigation on large meshes even when they happen to be visible.