i have a button “basic1” which is supposed to trigger a basic player attack when pressed the screen. ive defined “basic1” in the input manager,set the parameter “attack” in my animator, and set code for it, but when i press the button, nothing happens.
heres the basic code im using for this
public class attackT : MonoBehaviour {
public int speed = 2;
private int attack = 0;
public GameObject basic1;
Animator anim;
void Start ()
{
anim = GetComponent<Animator>();
}
void Update ()
{
attack = 0;
speed = 0;
if(Input.GetButtonDown("basic1"))
{
attack = 1;
}
anim.SetInteger("attack", attack);
}
}
is there something i forgot that just needs to be added? im new to scripting gui controls so i apologize in advance if i missed something basic.