Instantiating Nav Mesh Prefabs



  • I got this from the asset store because I was under the impression that it might help me with a project I'm playing around with.

    I'm instantiating islands from prefabs. They aren't dynamically generated, but are instantiated at runtime. I wanted to be able to basically save out a chunk of nav mesh with them in the prefab so I could have agents moving around on the islands after I drop them in.

    How do I do this with NavMesh Extension?



  • Hi Rich,

    I've answered your question by mail on March 19th. Quoted:

    "You can create prefabs of meshes and instantiate them along with your islands, as long as you bake them in the editor. Unity does not support baking NavMeshes at runtime."

    You can't save NavMesh data in a prefab, because it is included in your scene and will only change when rebaking. Your agents will only recognize the new area if you rebake the scene in the editor.



  • Ah, ok. When I read that I thought you were saying I could make prefabs of the nav mesh and instantiate them with the islands as long as I baked the nav meshes into the prefab beforehand. My mistake.

    So is there any solution you can think of to accomplish this? If you can't start the bake process at runtime, is there a way you can manually add triangles to the nav mesh through script?



  • is there a way you can manually add triangles to the nav mesh through script?

    Not currently, no. Unity does not expose any NavMesh API. This is an often requested feature and Unity is well aware and working on it:

    http://forum.unity3d.com/threads/any-official-word-on-the-future-of-navigation.311172/#post-2024317


Log in to reply