Search Unity

Help Wanted Best approach for baking navmesh

Discussion in 'AI & Navigation Previews' started by chris_gamedev, Jan 12, 2021.

  1. chris_gamedev

    chris_gamedev

    Joined:
    Feb 10, 2018
    Posts:
    29
    I have a scene that's built up of various mesh tiles of different types. They are all prefabs.

    I have roads, sidewalks, different types of roads and sidewalks etc.

    There seems to be two main approaches. a) I could select objects and check "Navigation Static" and then "Bake" within the Navigation window. This seems to work but I'd have to select each gameobject and assign it as static. Or b) I could use the navmesh components like NavMeshSurface and apply those to the prefabs directly, adjust settings and bake in the component and have that component propagate across all gameobjects of that prefab. That seems attractive.

    Which approach is best?

    An issue I seem to have is if I choose approach b) then my Nav Mesh Agent can no longer walk from e.g. one sidewalk to the next even though they both have the baked surface component.

    My assumption was perhaps that I'm baking the nav mesh for that component in that position and so my agent doesn't see the adjacent surface but I have tested this and when each component has a separate baked asset assigned the agent still doesn't walk to the adjacent surface.

    So essentially, two questions:

    1) What am I doing wrong with the NavMeshSurface component and, more generally,
    2) What is the best approach for this, should I just stick with assigning the navigation statically?

    Many thanks!
     
unityunity