NavMeshAgent with Collider as Trigger call OnEnter/OnExit endlessly

Hero have NavMeshAgent component and capsule collider as trigger. On collide with someones collider (as trigger too) there is invokes both OnTriggerEnter and OnTriggerExit event on Hero on both colliders. Start calls, call every frame, and ends when colliders stop intersect.

Rigidbody on Hero. Have or not Rigidbody on collided thing - not matter.

Without NavMesh everything is ok.

Is there a way to solve problem, or I have to give up NavMeshAgent?

1 Like

I’m experiencing the same issue. Did you manage to solve it or does anyone know why this keeps triggering endlessly?

Thanks in advance!

I wouldn’t throw the NavMeshAgent away just yet. There are still a few steps you can try to debug this situation.

I assume you are running some kind of check inside the OnTriggerEnter() thread to make sure the object it’s colliding with is the right one for whatever it’s doing.

What you want to do now is find out what object is causing the continuous call. Try adding this to your OnTriggerEnter() code:

void OnTriggerEnter(Collider other)
{
     //Put this above all the other code so that you know it's getting called correctly.

     Debug.Log(other.gameObject.name);

}

That should at least let you know what it’s colliding with.