Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

NavmeshModifier & NavMeshModifierVolume: why are they separated?

Discussion in 'AI & Navigation Previews' started by Yandalf, Oct 4, 2018.

  1. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    So I'm diving into the NavMeshComponents code and find a few things that confuse me.
    In the NavMeshSurface, when you try to rebuild or update you first Collect all the sources.
    This Collect method first looks for the NavMeshModifiers according to the selecting method (all, children, volume), generates markups based on these, and then feeds both the collected sources and markups to NavMeshBuilder.CollectSources. Only after that has been done does the Collect method search for the NavMeshModifierVolumes, and filter out obstacles and agents.
    Why doesn't NavMeshModifierVolume simply inherit from NavMeshModifier? That way you'd be able to search for both of them in one go and generate the markups (something that, for some reason, is never done for the Volumes?). I'm asking this also because the AppendVolumes method used to find and add Volumes doesn't do exactly the same filtering as the CollectSources does with the regular Modifiers: the Volumes do not get filtered on the Navmesh Bounds!
    I feel this split between the two makes things a little overcomplicated.