Why isn't my ladder working properly?

I tried searching around for a way to make a 3D ladder within Unity, so you can climb up and down when near it. I found this topic here: How to make a simple ladder? - Unity Answers The code in the accepted answer was JavaScript, and I’m used to C#, but I was kinda desperate and figured it would work, so I imported it and adapted it slightly to fit my project.

My game is sort of Minecraft-esque and the game world composed of blocks. The ladder prefab I’m using is only one block high, so it can be stacked to create longer ladders. The ladder prefab has a box collider set as a trigger, positioned so if there are any ladder sections above it, the colliders will overlap to form a continuous trigger. The idea is that while the player is in that trigger, they can press the forward or back keys to move up and down the ladder.

However, what I’m finding is that while the player is in the trigger, pressing forward or back merely causes them to jiggle up and down endlessly. It seems that the upward or downward movement is applied for only one frame before the character falls back to where they were. They can also still actually move forwards or backwards, say if they’re not quite facing the ladder, but still with the jiggling effect. I’m wondering if this is down to using triggers, or because I’m using the default Unity First Person Controller, or there’s just some inherent problem with the code that was overlooked.

(BTW, like I said, I got this code from another topic here, but since that one’s been marked as answered and has been inactive for a while I felt it would be better to make a new topic rather than drag up an old one. Code’s author was awesomeface, if that matters)

EDIT: Another thing worth mentioning: if I jump at the ladder while holding W, I’ll jump significantly higher than usual, so the code is working to some extent. However, I still can’t climb ladders taller than 3 blocks, and I’d prefer not to have to jump to climb them.

Here’s the code:

var playerObject : GameObject;
var canClimb = false;
var speed : float = 1;
function Start () {
    playerObject = gameObject.Find("First Person Controller");
function OnTriggerEnter (coll : Collider){
    if(coll.gameObject == playerObject){
       canClimb = true;
function OnTriggerExit (coll2 : Collider){
    if(coll2.gameObject == playerObject){
       canClimb = false;
function Update () {
         playerObject.transform.Translate (Vector3(0,1,0) * Time.deltaTime*speed);
         playerObject.transform.Translate (Vector3(0,-1,0) * Time.deltaTime*speed);

Did you try disabling gravity on the player object? Seems that could fix it.

try setting the trigger on only one collider if your ladder is different sections

i made a video doing this type of thing hope it helps Unity Tutorial Ladders With Free Script Included Unity 5 supported - YouTube