- Home /
Problem to Play an animation with GUI buttons
hy there, I want to make three GUI buttons. they shall influence an animation in another GameObject. 1 stop the animation 2 play the animation as it was before and play the animation backwards. I have three scripts and in a way it works pretty fine but if I hit first the "Stopp Button" (works) than the Button for play the animation backwards (works) and than the button to play the animation normal it jumps 360° in the right direction an stops. But if I do it like this: 1. stop 2. play normal 3. play backward, it works...
so this is what I have:
StopButton:
var Podest : GameObject;
function OnMouseUp(){
Podest.gameObject.animation.Stop ("Podestanimation");
}
Start the animation without any modification
var Podest : GameObject;
function OnMouseUp () {
Podest.gameObject.animation.Play("Podestanimation"); }
backward:
var Podest : GameObject;
function OnMouseUp () {
Podest.gameObject.animation ["Podestanimation"].normalizedTime = 1; Podest.gameObject.animation ["Podestanimation"]. speed = -1; Podest.gameObject.animation.Play ("Podestanimation");
}
So any suggestions?