NavMesh Resources Requirement


#1

What are the “technical requirements” behind requiring NavMesh source meshes to be in the Resources folder? It looks to me like NavMeshGenerator.GenerateNodes just needs vertices and triangles to create the nodes. I ask because I’m trying to work with a procedurally generated mesh, and I’m not sure if the better approach is to

  • Try to get around the Resources requirement for NavMesh, or
  • Generate a PointGraph manually based on the mesh’s vertices

(using pro version)
Thanks!


#2

Hi

The requirement is there for serialization. Since all graphs can be serialized to json files and loaded on demand (and they are also serialized internally as json even in the editor) I cannot rely on Unity’s serialization routines. Specifically if I deserialize something during runtime, the script needs to be able to find the mesh, and that can only be done if it is in the Resources folder.
During runtime you can assign any mesh to the mesh field on the navmesh graph and it will work just fine, it’s only for serialization that it is required that it is in the resources folder.