TreeClimb animation in unity

I was wondering if it’s possible to make an animation inside of unity(presumably a transform animation) that makes my character move up by a certain distance(tree height). I was trying to do something like this, but failed. Can anyone help, please?

This topic provides an (accepted) answer about how to make the character climb a “climbable” object (in the linked post it’s climbing a wall but the theory behind it is the same)

You need a collider around the climbable object. Once the player is inside the object you want to map horizontal movement to vertical movement.