how can i change animation speed forever

i have an animation "idle" is very fast. i want to make it x1/2 speed. how can i do that. but im talking about "forever"

2 Answers

2

You can attach this script to any gameobject that has animations and change the speed to what you desire.

var animationSpeed:float;

function Update () {
    for (var state : AnimationState in animation) {
        state.speed = animationSpeed;
    }
}

Just put this in your Start. Nothing special about Start -- that's just the easiest place to put it. There isn't an Inspector setting for it:

animation["idle"].speed = 0.5f; // "f" is for C#

http://unity3d.com/support/documentation/Manual/Animation%20Scripting.html also has a pile of examples.

@Owen, please submit the bug report - we're not aware of this issue. As far as I know it should work in Start (and it works for me). It doesn't work with CrossFadeQueued (it doesn't clone some properties correctly).

Gah. Turns out that weight needs to be set AFTER play or it snaps to 1, not time as I wrote at first. Just reconfirmed weight not being forever. Saw the "forever" in the question and confused the two.