Is there a way to call the same actions trhought different Keyboard keys ?

Hello everyone !

I’m testing the new input system, and let’s say it’s great !
I’m currently settuping a small project to just get my hand on that and right now I have no trouble when I play with multiple controllers!

The only question I have, is that, is there any way to play with multiple players on the same Keyboard just by binding the same action ?

Right now I have the move action from the sample project, and I just had arrow keys into it. Sadly, the player is binded by arrows keys and QWSD !

Would their be anyway to “split” that ?

Thank you :).

  • Set up controls with separate control schemes for left keyboard use and right keyboard use (e.g. “KeyboardLeft” and “KeyboardRight”).
  • Either manually spawn players and assign the device or do it retroactively.
// Spawn two players with split-keyboard setup.
PlayerInput.Instantiate(playerPrefab, controlScheme: "KeyboardLeft", device: Keyboard.current);
PlayerInput.Instantiate(playerPrefab, controlScheme: "KeyboardRight", device: Keyboard.current);

// Or do it retroactively.
PlayerInput.all[0].SwitchCurrentControlScheme("KeyboardLeft", Keyboard.current);
PlayerInput.all[1].SwitchCurrentControlScheme("KeyboardRight", Keyboard.current);

Hello Rene !

Thank you for your reply.
So from what I understand, it’s not possible right now that the InputManager spawn automatcly an other player when a "second keyboard’ is detected ?

Your solution seems perfect for my needs ! Can it be merged with the InputManager ? (Meaning that the input manager spawns automaticly controllers and I spawn automaticly keyboard inputs ?)

Also, would it be able to delete a PlayerInput ? (If a player disconnect, for exemple).

Thank you very much !

EDIT : Seems like it’s sadly not working.

var playerSpawned = PlayerInput.Instantiate(playerPrefab, -1, “SecondKeyboard”, -1, Keyboard.current);

1/ If I give “SecondKeyboard” (It only contains Arrow key), then it just use the WASD key (From the MouseInput scheme) and not even the Arrow key
2/ If I give “MouseInput”, same behavior
3/ If I give “Gamepad”, then the arrow are working, but not the WASD, which is great. But the Gamepad is also working …

Do you have any fixes for that ? Thank you :slight_smile: