I know this question is asked frequently, but none of the answers helps.
I want to wait until an animation is finish.
My code (not in an Update function):
Animation = this.gameObject.GetComponent(Animator);
function manipulate(){
if (Input.GetKeyDown(KeyCode.E)){
if (Open == false){
Animation.Play("Tür|Door_70");
}
Open = true;
}
}
Now I want the boolean 'Open' toggles only when the animation is complete.
I've tried:
yield WaitForSeconds (Animation.clip.length);
yield WaitForSeconds (Animation.clip("Tür|Door_70").length);
yield WaitForSeconds (Animation.state.length);
yield WaitForSeconds (Animation.state("Tür|Door_70").length);
yield WaitForSeconds (Animation.length);
while (Animation.isPlaying){ ... }
while (Animation.clip.isPlaying){ ... }
while (Animation.clip("Tür|Door_70").isPlaying){ ... }
if (Animation.isPlaying){ ... }
if (Animation.clip.isPlaying){ ... }
if (Animation.clip("Tür|Door_70").isPlaying){ ... }
... and so on. What's the right command I need to do??
↧