- Home /
2 Player - best way
I'am looking in creating a 2 Player game (co-op) not online. the current way I see of acomplishing this would be
if (Input.GetKey("Player1Fire") {
} else if (Input.GetKey("Player2Fire") {
}
thats just off the top of my head... is there an alternative?
Just have two completely different sets of controls, yes. There's no reason to put them on the same script, however, and you shouldn't use 'else if', because that means that player 1's inputs can mask player 2's (and you don't want that).
I get setting up different Inputs from the editor I just cant seem to wrap my head around this maybe i've been thinking to much but should i jump copy all my scripts from my previous FPS and name the Player1$$anonymous$$ouseLook.cs etc?
That's actually not much different from solo gameplay, you could write a single script - or many - to handle one(1) player input and expose(public serialized) the Buttons or $$anonymous$$eyCodes in the inspector. Create 2 instance of the script by dragging it twice on a GameObject and set different inputs for each instance/player.