I want to play the melee animation when I click the left mouse button, but for some reason, I can’t play the animation after I click. Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimationController : MonoBehaviour
{
public Animator anim;
void Start()
{
anim = GetComponent<Animator>();
}
void Update()
{
if (Input.GetMouseButton(0))
{
anim.Play("Melee");
}
}
}