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.
Main Question: In the Project folder, find the animation, and make sure it’s NOT set to looping. Once you remember a few basic things to check for the animation system, it’s cake. I made a game with custom animations in a 48 hour game jam recently, would never use anything but Unity to attempt this.
“Another thing”: animation[“ani-name”].length is the correct way to do it. Post a new question with the error messages so someone else can solve it…
Both might be solved by setting up the animation properties properly in the Project folder, i suspect that’s where ure main problem lies.