- Home /
Animation speed
Hey buddies,
I am quickly trying to have an animation done inside unity, which works fine, but I am struggling a bit on how to speed up that animation or slow it down by using different int when the score reached to a certain number.
So this is the script which is being a function that I call inside the Update function. Anyone can tell me what is wrong?
function SpeedChange(){
if(score == 10){
//ropeAnim = GetComponent.<Animation>();
ropeAnim["Rope_Rotate"].speed= ropeAnimSpeed;
}
}
If I recall correctly (I don't have access to Unity at the moment), the speed is a float: a value that ranges from 0 to 1, where 0 means static and 1 equals to a 100% fluid motion.
I would do this ins$$anonymous$$d:
AnimationState myAnim = ropeObject.GetComponent<Animation>()["Rope_Rotate"];
myAnim.speed = 0.5f;
hey, thanks for your reply. I did try that but it is giving me this error message "UCE0001: ';' expected. Insert a semicolon at the end." though I did put a ";" at the end.
Answer by lordlycastle · Apr 20, 2015 at 03:47 PM
I don’t know if you’ll be able to change the speed of just one animation from script, but I’m sure someone has found a hack. One way is to speed up, and slow down every thing the game using Time.timeScale. This should change the speed of the animation, but also everything else too.
Answer by kimardamina · Apr 21, 2015 at 03:17 PM
Hey, I have tried that Time.timeScale and did not get the result expected so I thought there is actually a good way to have it done using the speed value. thanks for your reply
Your answer
Follow this Question
Related Questions
Chande animation speed 1 Answer
how can i change animation speed forever 2 Answers
Problem : Change speed animation when run it not smooth 1 Answer
Why is instantiated animator prefabs are not working properly? 2 Answers
Making an animation on Input run at a speed declared by a variable in another script? 0 Answers