- Home /
splitscreen fps input
hi unity peeps, I've been trying to create a local split screen multiplayer fps in unity and I am having trouble with setting up the player controls, I have the player prefabs set up but I need a controller script for each player, anyone know how to set up separate controls for each player, I'm going to use doom style controls with a fixed aiming angle ?
cheers
Answer by aidan7501 · Dec 09, 2016 at 06:18 AM
you could do an if statement stating if you are player 1, then use player 1 controls, and if you are player 2, use player 2 controls. Make sure to set up different inputs in unity for player 1 and 2, so for example in input settings, use movePlayer1 as player 1 movement, and movePlayer2 as player 2 movement button. It would look sort of like this (c#):
public bool player1; public bool player2;
// Update is called once per frame
void Update () {
if (player1)
if (Input.GetButton ("moveForwardPlayer1"))
//move player 1
if(player2)
if(Input.GetButton ("moveForwardPlayer2"))
//move player 2
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612102256im_/https://answers.unity.com/themes/thub/images/avi.jpg)