- Home /
Problem playing animation C#
Hey guys, I've looked around on previous answers and even adjusted the code, it still didn't work so i went back to the way i wrote it. It seems to be self explanatory so i don't understand why the script isn't working.. Also, i have the animation on the same gameObject. I tried to set it as.. When left click is pressed down, activate animation. (every time its pressed the animation should play). This is my code.
using UnityEngine;
using System.Collections;
public class axeAnimation : MonoBehaviour {
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Fire1"))
{
animation.Play();
}
}
}
Answer by RussianBsack · Jul 30, 2014 at 08:04 PM
I figured out what the problem was, i had to set the animation to Legacy, this can be done by selecting your animation, then in the inspector on the top right next to the lock, click on the drop down list and select Debug, then enter the number 1 (its usually a 2). Hope this helps anyone else having this problem.
Listen to your console lol.