- Home /
Question by
elilittrell · Dec 23, 2020 at 08:47 PM ·
leftmouseclick
Left mouse button not working
I am trying to simply play an animation in my PlayerCombat.cs script, (following steps from a Brackeys vid)
// Update is called once per frame void Update() { if (Input.GetKeyDown("Fire1")) { Attack(); } }
void Attack ()
{
//Play an attack anim
animator.SetTrigger("Attack");
//detect enemies in range of the attack
//apply damage
}
I have done all things for the animator to work in unity, but its just not working. how do I fix this, does it have to do with the input system?
Comment
Answer by Pokedlg3 · Dec 23, 2020 at 08:55 PM
The correct one is Input.GetButtonDown ("Fire 1")
void Update ()
{
if (Input.GetButtonDown ("Fire1"))
{
Attack ();
}
}
void Attack ()
{
//Play an attack anim
animator.SetTrigger("Attack");
//detect enemies in range of the attack
//apply damage
}
Your answer
Follow this Question
Related Questions
Mono CAN NOT CLICK ON ANYTHING!!!!! 1 Answer
Inventory GUI 0 Answers
Set asset as weapon with animation and destroying other assets on impact 0 Answers