Search Unity

Question NavMeshAgent autoRepath triggered even if toggled off

Discussion in 'Navigation' started by johannesgaebler, Oct 11, 2021.

  1. johannesgaebler

    johannesgaebler

    Joined:
    Jun 17, 2019
    Posts:
    28
    Hey all,

    this is probably the last issue I encounter before fixing all my AI issues. =D

    I have a nav mesh which gets baked and afterwards there are occasional, random nav mesh obstacles spawned.
    All agents have autoRepath disabled because it leads to pretty big issues for me and disabling autoRepath resolved 99% of them.

    The only true problem I still have is that apparently, every time a nav mesh obstacle is placed on the map (and carves a hole), the autoRepath is triggered for all agents, even though it's disabled.

    I am not entirely sure if it's the case because there are no events and so on but I am 99% sure because the problem is exactly like before switching autoRepath off and the problem does not appear if I do not spawn nav mesh obstacles.

    Does anyone know of that issue? I found one other thread making a comment on this exact problem (autoRepath is off but still being triggered with carving/nav mesh obstacles) but that's it. No other findings unfortunately.

    Any help highly appreciated again! Thank you!!


    tl;dr: NavMeshAgent.autoRepath == false but repathing is triggered when NavMeshObstacle spawnes.
     
    ChrisKurhan likes this.
  2. ChrisKurhan

    ChrisKurhan

    Joined:
    Dec 28, 2015
    Posts:
    268
    I also can observe this behavior on really simple repositories. I'm submitting a bug because this seems like whenever the "carving" happens, it likely invalidates either all Agent paths, or all agents that would go through that area. When this happens it should respect the "autoRepath" property on the NavMeshAgent but doesn't.
     
    johannesgaebler likes this.
  3. Harling

    Harling

    Joined:
    Jun 27, 2018
    Posts:
    3
    This issue appears in my project too.Anyone can help?
     
  4. johannesgaebler

    johannesgaebler

    Joined:
    Jun 17, 2019
    Posts:
    28
    It's been quite a while since I touched this code last but I am pretty confident I never got this to work properly. My workaround was to properly communicate to the player that the agent is recalculating it's path (I added visual indications and flavoured it with a "decision making/thinking what to do next" state).
     
  5. Harling

    Harling

    Joined:
    Jun 27, 2018
    Posts:
    3
    It means you dropped “autoRepath” property,right?