Search Unity

Bake NavMesh on Runtime

Discussion in 'Navigation' started by SSL7, Nov 9, 2017.

  1. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    Hello,

    I am trying to do something simple but I try to find the best way to do it. So I create terrains in runtime and I want to bake the navmesh while they created. A simple way to do that for now is I use a LocalNavMeshBuilder at the center of each terrain with 1000x100x1000 to build the whole terrain, and navMeshSourceTag on the terrain. Is something better available cost-wise? I don't care about navmesh changes etc. I only need navmeshobstacle to work.

    Thank you.
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Its a really bad habit to optimize ahead of when needed.

    Rather than worrying about whether something might be a performance cost, make the program, run it and see.

    Only optimize if you need to or your just wasting time and resources.

    For 80% of the people who crop up on here asking stuff like this, they usually never end up needing to actually optimize.
     
  3. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    Well, I get you, but I have a feeling I don't do it the right way. Because I only need a pre-bake once per terrain, and using the localnavmeshbuilder seems a bit costly without reason, using all the update stuff etc. Thats why I asked :)

    about run it and see... I run it, and it works but I see my frames to drop a bit on runtime compared to bake a terrain in editor and then run it. So looking for a way to just bake in runtime :)