OnCollisionEnter not working between two rigidbodies

In the scene, I have a Character Controller with a non-kinematic rigidbody component, as well as an invisible wall (cube collider) with a non-kinematic rigidbody component. The former does not need a collider because the character controller acts as one. The latter has a box collider that is not set as a trigger. The wall has a script component that shows a dialog box when the character comes into contact with it:

function OnCollisionEnter(col : Collision) {
	if(col.gameObject.tag == "Player") {
		showPopup = true;
	}
	print("If this prints, it's working well enough");
}

In this case, the two objects collide, but the collision information is not sent (i.e. “print” is never called), so it’s not a problem with finding a tag (or else that’s still not the biggest problem). According to the documentation, it should work whenever a non-kinematic rigidbody collides with any other collision object, so I’m not sure what’s going on.

In another case where there are two walls which intersect each other, “print” is called, so it seems to be something to do with the character controller.

Yes, this sounds extremely basic (and yes, I only started working with Unity recently), but I’ve looked through several pages of answers to no avail; without exception, situations identical to this have been answered with “switch to triggers” or not answered at all. Of course, I can’t simply make the wall a trigger because then the player can walk right through it.

I did find a temporary fix by making another collider object that’s larger than the controller, parenting it to the controller, and making that a trigger (and switching the function accordingly), but I’d like to know if there’s a more elegant solution.

Try the OnControllerColliderHit function. the onCollision function is designed for two rigidbodys the CharacterController is not a ridged body. your controller may be hitting before your attached ridged body is