Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question Overlapping navmeshsurfaces causes bugs

Discussion in 'Navigation' started by unity_028AE3B1F1BC5DECE8AD, Feb 16, 2024.

  1. unity_028AE3B1F1BC5DECE8AD

    unity_028AE3B1F1BC5DECE8AD

    Joined:
    Jul 31, 2022
    Posts:
    94
    Hello,

    I have an issue with navmesh surfaces that overlap which causes agents to be unable to find paths when they are on them. I have been trying to look up a similar issue but can't find any solution/fix. My game is multiplayer on a large randomly generated map so instead of baking one large navmeshsurface at runtime which would take forever, I created a script navmeshsurfaces are baked around a local area of each player, to ensure agents are able to move when around players for example.

    The issue is when two players are near each other, they have two navmesh surfaces that overlap and this has led to a surprising result for me where for some reason navmeshagents pathfinding will randomly break and be unable to find a path if they are on a position where navmeshes overlap.

    Is there any solution, work around or "hack" etc to prevent this behaviour?