How to make local multiplayer?

FouriusCraft

New member
Hi. How to make local multiplayer? For example player 1 uses WASD player 2 Arrow keys, Do I have to make 2 cameras? Because when I made 2 players. One player who doesn't refer to the camera will get an error
 
I am assuming you mean split screen and not LAN multiplayer? For split screen, you would have to make a second camera and assign the character to its CameraController. Then figure out how to combine both camera outputs and change one of the player's input keys.

Multiple cameras can be costly for performance because of increased rendering, so locally networked multiplayer might be a better route depending on what type of game your building. If the rendering cost is pretty low for each player it might not be an issue.
 
I am assuming you mean split screen and not LAN multiplayer? For split screen, you would have to make a second camera and assign the character to its CameraController. Then figure out how to combine both camera outputs and change one of the player's input keys.

Multiple cameras can be costly for performance because of increased rendering, so locally networked multiplayer might be a better route depending on what type of game your building. If the rendering cost is pretty low for each player it might not be an issue.
Thank you. What if I want 1 camera for 4 players, and each player has different inputs?
 
You could probably get away with 1 camera if you were doing a static camera, top down, or side scroller game. You would need to make a custom CameraController that adjusts itself to keep all players in view, or alternatively, restrict all player's movement to stay within the camera view.

I would start with setting up multiple players with different inputs as this will take more time. I think this would need a custom UnityInput script that you can set the movement input names that you find in Project Settings. Once that is working, figure out the camera stuff including errors from not having a camera assigned to each player.
 
Top