I’m trying to create a split screen feature within my game for local multiplayer. The problem is that using a character controller I seem to not be able to control separate screens with different controls and for example using either WASD or the arrow keys controls both screens.
Is there a way to restrict both players to solely use either WASD or the arrows or should I use the new input system within Unity?
Thanks!
3 Answers
3
In the default Input settings with the old input system, both the arrow keys and WASD are mapped to the Horizontal and Vertical axes. So if you are trying to get input using Input.GetAxis(“Horizontal”), either option can be used.
If you want WASD and arrow keys to do different things, then you should look for the raw keys with Input.GetKeyDown(KeyCode.A) or Input.GetKeyDown(KeyCode.LeftArrow).
Yes this was how I did it in the end @dstears just forcing the raw inputs to be WASD and then using the Input system to handle the second player (Which is also way easier and what I’ll be using in future projects)
Thank you both anyways!
Hello @AlexG32, while @dstears is correct, you don’t have to use raw input. Simply go to the input manager, and edit the Horizontal and Vertical inputs to only except arrow, no alts. Then, edit an unused input to only use WS, then name it Horizontal2. Do this for a vertical input as well, and you will be able to use Axis inputs instead. In my opinion, this is more optimized, but it really depends on how you’re using it. Raw input may work better in some cases.