I really hate the mecanim animation system, i can’t simply do animation.play("blabla");
i need to do a lot of things just to play an animation lol.
so, i’m here to ask someone how i can play an animation just once, i press a button, and it just play ONCE the animation. i’ve tryed that:
public Animator weaponAnim;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown ("Fire1")) {
StartCoroutine("Shoot");
}
}
public IEnumerator Shoot () {
weaponAnim.SetBool("inShoot", true);
yield return new WaitForSeconds (weaponAnim["Shoot"].lenght);
weaponAnim.SetBool("inShoot", false);
}
and another thing i need is: how can i get an animation lenght? i used weaponAnim["blabla"].lenght
, but it gives me errors.