- Home /
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"
Answer by Kourosh · Apr 17, 2011 at 06:58 AM
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; } }
Answer by Owen-Reynolds · Apr 18, 2011 at 12:01 AM
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.
Your answer
Follow this Question
Related Questions
Chande animation speed 1 Answer
Animation speed 2 Answers
Change animation speed in a script on Unity 5(JavaScript) 1 Answer
How to change motion/animation in Animator with C# script? 0 Answers