Greetings! I’ve got such a question:
I want to control my animation movement speed by pressing a key on a keyboard.
For example, when the specified key is held, animation plays (play speed 1.0), but when I release the key it should stop (play speed 0.0). And when I will press the key again it continues from the point where it was stopped.
I’m trying to deal with it in this way:
function Update (){
if(Input.GetKey("page up"))
animation.Play("animation_name");
animation["animation_name"].speed= 1.0;
else
animation["animation_name"].speed = 0.0;
}
It doesn’t work, saying: BCE0044: expecting }, found 'else and something like that. I know that I do it wrong, but don’t know how will be correct.
I wish if only you could help me with this task. Just some advices.
PS: I have read practically every topic concerning this question, but still don’t understand.