NavMeshAgent with NavMeshObstacle


I am aware that you can not have an Agent and an obstacle on the same GameObject. However, I find that the obstacle is much more reliable for pathing. Does anyone know any tricks to treat agents as obstacles? Perhaps a way for an agent to ignore its own obstacle?

I have tried toggling between the agent and obstacle when stopping, however, this is unreliable as the obstacle disabling is not immediate, and the agent will jump from the position. I have gotten past this by waiting 100 milliseconds or so before enabling the agent, but it is still just very hackish.

Please, anyone have a better solution?

I am looking into A*, but thats a lot to learn with out knowing if it will fix my problem.

4 years late here, but I just have a method to toggle the agent and obstacles enabled/disabled. The trick is to wait for the navmesh to update after disabling the obstacle before enabling the agent. I found an invoke() call for a 0.1 sec delay works for me. They just can’t be done the same frame if that makes sense.