Animation Wrapmode - once the value is set in code, can it be changed behind the scenes?

I have an animation controller class that I made, for a character that runs around and jumps. All of that works fine. I decided to add a sword slash. I put in the animation, then put in this code in the start function of the animation controller script.

    var oneHandSwordAnim = animation["up_sword_action"];
    oneHandSwordAnim.wrapMode = WrapMode.Once;
    oneHandSwordAnim.layer = 3;

I would think that would set the wrapmode for the animation for any further time I felt like using it. But in the update when I play that animation, it loops anyway. I looked in the debugger and the wrapmode was set back to loop. Is there anything that can change the wrapmode on animations like that out from under you? I use a similar technique in the jump animation and it works fine.

Thanks!

I found the same problem and the solution I’ve used is to do it the other way around. On the model set the Animation Wrap Mode to Once which will apply to all animations and then set the animations that need looping in script (i.e. walking, idling, etc).