Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

NavmeshModifier & NavMeshModifierVolume: why are they separated?

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

  1. Yandalf


    Feb 11, 2014
    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.