I'm making a top down shooter game in unity using the old input system and I ran into a problem. I use the arrow keys to shoot but I'm not sure how to fire in multiple directions at the same time/frame. Code:
void Update()
{
currentTime += Time.deltaTime;
//input section
if (Input.GetKey(KeyCode.UpArrow))
{
ShootUp();
}
if (Input.GetKey(KeyCode.DownArrow))
{
ShootDown();
}
if (Input.GetKey(KeyCode.LeftArrow))
{
ShootLeft();
}
if (Input.GetKey(KeyCode.RightArrow))
{
ShootRight();
}
if (Input.GetKey(KeyCode.UpArrow) && Input.GetKey(KeyCode.RightArrow))
{
ShootUp();
ShootRight();
}
}
I thought that looking at both arrow keys at the same time, I would just call both functions as well. Its does not work however. I tried google but it's pretty hard to find info on the old input system having the same problem.