animation to play faster over time

Hello,
I am trying to have my animations play faster as time goes along. referring to a timer script. this is what i have, it recognises and prints time, but doesnt speed-up the animations. a novice at scripting here :frowning:

function Update () {

print(other.score);

if (other.score >= 0){


animation.PlayQueued(anims[Random.Range(0, anims.length)]).speed = animspeed;

}



if (other.score >= 4){

animspeed = 2f;


}

 
if (other.score >= 15){

animspeed =7f;

}

}

If you want to modify the speed of an animation, you’ll have to use AnimationState.speed as this has a speed property you can set. As per the documentation 1f or 1.0f is regular speed, 2f/2.0f is double and -1f/-1.0f is regular speed backwards.

You are almost there. AnimationState.speed changes the speed of the animation clip. Take a look at the example.