@luycaslima I believe I found the solution on how to assign multiple players to a keyboard, after a lot of frustration. I still need to test with other button inputs besides movement but my solution seems to be working for movement so far.
Firstly,
Beginning with the Input Actions, create an action map and map both the WASD and Arrow Keys to the “Move” action or whatever you’re calling the action. I made up mine with two 2D Vector’s after setting the action type to “value” and Control type to “vector2”.
Then create two Control Schemes, each named for the the control type you want to use and require the keyboard in the list (e.g KeyboardWASD for WASD control, and KeyboardArrows for Keyboard Arrows control). Go back to “All Control Schemes Tab”, and then for each of the Up/Down/Left/Right keybinds, click on the checkmark of the WASD scheme for one of the 2D Vectors, and do the same for the Arrows scheme. Basically, all keybinds that are going to be used in a specific scheme’s 2D vector need to have their checkbox checked for all of the necessary controls they need.
(A keybind within the Arrows 2D Vector has the KeyboardArrows scheme checked)
(A keybind within the WASD 2D Vector has the KeyboardWASD scheme checked)
That should complete all of the necessary steps for the PlayerInput portion
Secondly,
On the Two Gameobject/Prefabs, add a Player Input component and assign the previously created PlayerInput object into the Actions variable. Assuming the players are already in the scene, in the default scheme dropdown, switch one over to the WASD Scheme and the other to the Arrows Scheme. One important thing, make sure to switch the behavior to Invoke Unity Events.
(WASD player PlayerInput Component’s Default Scheme)
(Arrows player PlayerInput Component’s Default Scheme)
Before getting to the Unity Events, go to your Player or Controller script. Declare a public method with a Callbackcontext variable. Implement a Vector2/3 variable that can store input from your keyboard. My implementation, its called OnMove, and it assigns the Vector2 player input into a variable called move direction, to be used in a move function shown below.
EDIT 1: also make some conditional logic to decide which gameobject gets which control scheme, for me i just did a gameobject name check
(for those not familiar with lambda, the code right of the arrow is just a singular method body, so it just calls that one singular piece of code).
(my implementation of movement, called in Update() )
(EDIT 1: conditional logic to switch control schemes)
Thirdly,
After getting the Gameobjects and Script setup, go back to your gameobjects once again, and dropdown the Unity Events section, and then one more dropdown of whatever you called your Action Map. You should see a “movement” Event depending on what you named it, press the plus button, and drag the movement script on the gameobject you’re currently on, down or over to the field where it says “None (object)” and it should load up with the script. Click on the dropdown, and navigate over towards your script class name, find your Movement method, and assign it. Do the same for the other gameobject, as its alright if they share the same script as long as the movement is setup in a mostly modular fashion.
(First Player or one of the players)
(Second Player or one of the other players)
With that it should be working! Let me know if any issues arise and I’ll try to look into them but after poking around on forums and with videos telling me nothing, this seemed to work pretty well.