Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Javascript; Wait for animation

$
0
0
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??

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>