Search Unity

  1. The 2021.2 beta is now available. To find out what's new, have a look at our 2021.2 beta blog post.
    Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  3. 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:
    462
    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.
     
unityunity