I am trying to make an animtion for my Sword so that when I click with my left mouse button, the sword gets swung. I watched a tutorial video and tried to follow all the steps but whats happening is that the Sword animtion gets played automatically in a loop
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Sword : MonoBehaviour {
void Update () {
if (Input.GetButtonDown("Fire1"))
{
GetComponent<Animation>().Play("Attack");
}
}
}
I know this isn't much to work with but maybe someone knows what I could have done wrong in the previous steps
