Hello,
can anybody give me a hint why Cursor and WASD keys are working great for me but joystick / gamepad does not? Gamepad is detected by Windows (10). Unity is 2022.14.
Local multiplayer game.
My EventSystem gameobject in the game scene looks like this:
My code for moving looks like this. WASD and Cursor keys work perfect. the gamepad move is never been called:
public void OnMoveWASD(InputValue value)
{
if (GameManager.Instance.State == GameManager.States.Map)
{
Navigator.Instance.Move(value);
}
if (GameManager.Instance.State == GameManager.States.Game)
{
if (Globals.Players[0].InputIndex == 1 || Globals.Players.Count == 1)
{
P1Control.Move(value);
}
else if (Globals.Players.Count > 1)
{
P2Control.Move(value);
}
}
}
public void OnMoveCursor(InputValue value)
{
if (GameManager.Instance.State == GameManager.States.Map)
{
Navigator.Instance.Move(value);
return;
}
if (GameManager.Instance.State == GameManager.States.Game)
{
if (Globals.Players[0].InputIndex == 0 || Globals.Players.Count == 1)
{
P1Control.Move(value);
}
else if (Globals.Players.Count > 1)
{
P2Control.Move(value);
}
}
}
public void OnMoveGamepad1(InputValue value)
{
if (GameManager.Instance.State == GameManager.States.Map)
{
Navigator.Instance.Move(value);
}
if (Globals.Players[0].InputIndex == 2 || Globals.Players.Count == 1)
{
P1Control.Move(value);
}
else if (Globals.Players.Count > 1)
{
P2Control.Move(value);
}
}
public void OnMoveGamepad2(InputValue value)
{
if (Globals.Players[0].InputIndex == 3 || Globals.Players.Count == 1)
{
P1Control.Move(value);
}
else if (Globals.Players.Count > 1)
{
P2Control.Move(value);
}
}
the linked input action looks like this:
Can anybody tell me why my gamepad / joystick does not work at all but cursor keys / wasd are working fine?
Thanks a lot!