OnTriggerEnter doesn't work with the Character Controller

I’ve made a player with a Character Controller, and no other Collider.

I am trying to use the function OnTriggerEnter or OnTriggerStay, but it doesn’t seem to work with the Character Controller.

Does anyone have any idea as to why? Or maybe what else I could do?

Make sure that the Collider that is attached to the script object is tagged as Is Trigger

And if it doesn’t work try something like this:

Note: this code is not C#, it’s legacy JS-like language

function OnTriggerStay (Col : Collider)
{
	if(Col.tag == "Player")
	{
		//Do magic
	}
}

Attach it to the gameobject that has the Collider set to Is Trigger And be sure to tag the player as "Player"

If it doesn’t work post some pictures and explain more what is happening

There is this method for collisions on Character Controller:

I notice in the docs, under Inherited Members that isTrigger is actually listed. Perhaps this will actually work to change the CC collider to a trigger? May cause problems, who knows, you can but only try.

A CharacterController implicitly comes with a collider, but behaves a bit different when it comes to collision callbacks. After some testing in Unity 2021.3.33f I can confirm the following:

  • OnTriggerEnter works
  • OnCollisionEnter does NOT work
  • Instead of that, you should use OnControllerColliderHit when moving the CharacterController with Move

So if OnTriggerEnter is not working for you, double check whether the collider you are colliding against is actually marked as trigger, via the Is Trigger checkbox on it, or whether your Character Controller has non-zero height/radius. If all that is in order, it should work, otherwise it is most likely a bug in the version you are using.