Animation looping on C# Boolean Value

using UnityEngine;
using System.Collections;

public class LadderControl : MonoBehaviour {
   
    public bool LadderCont;
    public Collider LadderMesh;
    public MeshRenderer LAC;
    private bool Anim;
   
   
    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {
   
       
       
        if(LadderCont == false){
            LAC.animation["LadderUp"].wrapMode = WrapMode.Once;
            LAC.animation.Play("LadderUp");
            LadderMesh.enabled = false;
           
           
           
    }else{
            LAC.animation.Play("LadderDown");
            LadderMesh.enabled = true;
        }
}
}

Basically, I have a button activated using a Raycast. I have an animation for a ladder coming up and a ladder sliding back down. However, the animation loops for some reason. Can anyone help me with this small problem?

Please, I could really use the help.

With your logic, it looks like EITHER Play(ladderup), OR Play(ladder down) will be called every single update. You probably want to call this function inside some kind of onclick logic, rather than right inside update like that. Or perhaps just add some change detection, for LadderCont.

simple change detection example:

    public bool LadderCont;
    private bool lastLadderCont;
    void Update () {
        if(lastLadderCont!=LadderCont)
        {
            lastLadderCont=LadderCont;
            if(LadderCont == false){
            //....play
            }else{
            //....play
            }
        }
    }