Hello,
Im trying to animate my character bay making his hands either ‘swing’ or ‘shoot’
Like this:
But I’m randomly getting this error:
Those are the inspector elements:
Those are the Animators:
Those are the transitions:
And this is the code i attached:
public class Attack : MonoBehaviour
{
void Start()
{
}
void FixedUpdate()
{
if(Input.GetKeyDown(KeyCode.Mouse0))
{
GetComponent<Animator>().SetTrigger("swing");
}
if(Input.GetKeyDown(KeyCode.Mouse1))
{
GetComponent<Animator>().SetTrigger("shoot");
}
}
}
Sometimes it works, sometimes it doesn’t and I don’t know why or what is happening.
Any help is appreciated, thanks in advance.