I got a running game with the player running automatically and the only inputs for controls is shooting and jumping, they both work. The animation for shooting does work when I want it to, SOMETIMES. I don’t know why, but it will occasionally not play the shooting animation when it’s supposed to, sometimes it does that several times in a row and then will work again.
Here is the code that calls the animation for shooting
void zombieShoot()
{
if(Input.GetMouseButtonDown(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit))
{
if(hit.transform.tag == "zombieObstacle")
{
dude.animation.Play("shoot");
gunFlash.Play();
audio.clip = gunShots[Random.Range(0,2)];
audio.Play();
}
}
}
}