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. Dismiss Notice

Question Nav Mesh Agent avoiding enemy range

Discussion in 'Navigation' started by dichtermut, Apr 3, 2023.

  1. dichtermut


    Jul 21, 2018
    All my units have a detection radius (Gizmos showed below) which defines the units that they are aware of.
    One type of unit, representing a thief, should be able to walk outside the detection radius of their enemies, while trying to infiltrate the enemy's base.

    I tried to accomplish this effect by declaring the enemies as Nav Mesh Obstacles, but then they carve out their own navigation mesh not only for the blue 'thief' unit, but also for all their allied red units and for themselves. (The rest of the blue units, also, don't care about this detection radius obstacle, since they don't have to actively avoid it, just the thiefs).


    I then tried to declare a new agent for the 'thief' unit, but the parameters that Unity allows to configure the agents don't help me in this.

    So my question is: is there a way that I'm missing that allows me to apply this functionality using Unity's AI package? I think that this should be a quite used functionality so, if not within Unity's AI, is there any asset that could do what I explained, or should I implement it from scratch?