New Input System: arrows with and without modifier

Hi all,

I probably have a simple problem. I am trying to set up the new Input System so that i can press the arrow keys to move around and press control + arrow keys to attack in a certain direction. My Input Actions look like in the attached screenshot.

My Controller script looks like that:

public void OnMoveLeft(InputAction.CallbackContext context) {
  if(context.performed) {
    Move(Direction.West);
  }
}
public void OnForceAttackWest(InputAction.CallbackContext context) {
  if(context.performed) {
    Debug.Log(string.Format("OnForceAttack{0}", "West"));
  }
}

Pretty straight-forward. However, when I press leftCtrl+arrow key, the movement AND the force attack execute. How can I prevent that?

Thanks
Nico

5529982--568213--move_attack.png

There’s a few ways to workaround this until they release an official fix for it after 1.0.
Here’s the solution I went with:

You should be able to find some other workarounds in the forum if you don’t like this one.

1 Like

Thanks!
I did actually end up with a much easier solution. I added a ToggleAttackMode Action and changed my code like this:

public void OnToggleAttackMode(InputAction.CallbackContext context) {
  if(context.started) {
    // button pressed
    Mode = PlayerMode.Attack;
  }
  if(context.canceled) {
    // button released
    Mode = PlayerMode.Default;
  }
}

public void OnActionLeft(InputAction.CallbackContext context) {
  if(context.performed) {
    if(Mode == PlayerMode.Default) Move(Direction.West);
    else if(Mode == PlayerMode.Attack) {
      if(EquipmentSlots.AttackType == AttackType.Melee) MeleeAttack(Direction.West);
      else if(EquipmentSlots.AttackType == AttackType.Ranged) RangedAttack(Direction.West);
    }
  }
}