Only 4 buttons can be pressed at a time, so players cant move sometimes

Each Player Has their own Controls

i Change, Up Arrow and the other ones for each player---v i Change Up Arrow and the other ones for each player



public string UpArrow;
public string DownArrow;
public string LeftArrow;
public string RightArrow;

        transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);

        transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);

        transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);

        transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);

2 Answers 2


Keyboards have hardware limitations on how many keys can be pressed and recognized at the same time.

Your code is not the problem here, it's most likely the design of the keyboard.

  • 4
    \$\begingroup\$ This is why FPS PC games leverage Shift, CTRL, and Alt keys -- they don't count towards that 4 key limit. \$\endgroup\$
    – Dustin_00
    Jan 24, 2015 at 5:58
  • 4
    \$\begingroup\$ Ps. The trick for enabling a decent multiplayer experience on a single computer is to support multiple keyboards. They're cheap enough, and with a simple USB hub or two you can easily have dozens of them connected at the same time. Plus, it frees your players from having to all huddle around a single keyboard. \$\endgroup\$ Jan 24, 2015 at 16:13
  • 1
    \$\begingroup\$ Also, any branded gamer keyboard (even the cheapest logitech one) supports pressing at least 4 keys simultaneously. Mechanical ones generally works like a piano so you can use all your fingers. gaming.stackexchange.com/questions/6669/… \$\endgroup\$ Jan 24, 2015 at 21:01
  • \$\begingroup\$ However the default USB protocol only allows for 6 keys (plus the meta keys), so if you want a keyboard with more than that it needs to supply its own driver. \$\endgroup\$ Jan 25, 2015 at 14:15

Keyboards have a key matrix, where the buttons have been arranged into something roughly square, with the keyswitches each being tied to one row and one column. The keyboard activates each row and then reads the columns. If you sketch this out you will see that some button combinations must activate "phantom" keys. You can fix this with one diode per button (which is a substantial cost for a keyboard) and have full rollover. To avoid the phantoms, a keyboard without full rollover will ignore key combinations which are ambiguous.

Modifier keys are always designed so that they can be chorded.

Once the keyboard has a set of keys to report, it has to pack it into the USB HID report, which has one byte that's a bitmask of modifiers, and 6 bytes for other scancodes. So even with full rollover you're not likely to see more than 8 modifiers and 6 scancodes simultaneously.

(the keyboard report also has one byte that's always 0, making 8 total bytes)

  • 1
    \$\begingroup\$ It is likely worth noting that some keyboards (particularly razer ones) use a non HID compliant extension in order to enable true full key rollover even over usb. Additionally, ps2 ports did not have this restriction either and could perform n key rollover. \$\endgroup\$
    – Vality
    Jan 25, 2015 at 1:28
  • 2
    \$\begingroup\$ Technically there's nothing non compliant about having as large a keyboard HID report as you want. However, there is a USB boot HID standard which works as I described. This limited format was specified so that simple code in BIOS could understand USB keyboards. It's just more work to design a keyboard which switches out of that mode when the real OS launches. It's quite likely that Windows generic HID drivers would support as many scancodes as you like if your device has the right descriptors. \$\endgroup\$ Jan 25, 2015 at 1:53
  • \$\begingroup\$ Excellent, thank you for letting me know. Perhaps you could put that in the answer as it is valuable information. \$\endgroup\$
    – Vality
    Jan 25, 2015 at 1:56
  • \$\begingroup\$ Another name is n-key rollover. Somewhat tangential: I do have such a keyboard that works with Windows drivers loaded and in the UEFI firmware, but trips up the Windows bootloader and some bootable media - it actually freezes them. Traditionally, PS/2 connections were used for n-key rollover with USB limited to ~6, though that seems to be rarer recently. \$\endgroup\$
    – Bob
    Jan 25, 2015 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .