Is there an equivalent to OnCollisionExit for OnControllerColliderHit?

I am trying to make a 2D characterController climb an object. I can get them to start moving up when they come into contact with that object using:

function OnControllerColliderHit(hit : ControllerColliderHit)

{

if(hit.transform.tag == "treeTrunk")
{
ClimbingTree();
}

}

but unfortunately I can’t figure out how to tell it to stop when it reaches the top and is no longer touching the object anymore. Any suggestions?

If your “climbing” surface is the same for all obstacles and the only one colliding with the obsticles is your player, then I recommend you use OnTriggerEnter and OnTriggerExit to detect when the player hits an obstacle.

If you need more information about the collision (e.g. to tweak your animation), you can use OnCollisionEnter/OnCollisionExit instead which gives you some information about the contact point and normal.