How do I control which class I'm accessing?

I’m making a couch co-op game. This is my first time attempting multiplayer so this should be an easy question.

I’ve got a script called InputManager. Inside of InputManager are 2 public static classes: Player1 and Player2. Inside of those classes are variables associated to the corresponding controller.

This game also contains vehicles. Each vehicle has a script that controls its movement and this is how they would access variables from the InputManager: InputManager.Player1.jump or InputManager.Player2.jump.

However my problem is, I only want to read the input from the player that is currently driving the vehicle, something like this: curPlayer.jump

How do I do this?

You can’t with static classes.

That’s the reason why we actually have instances of classes, so we can reference them. What’s actually the difference between Player1 and Player2? Usually you would have a Player class and then have an instance for player1 and one for player2. If the code for those should be different you could create seperate subclasses for each and create one instance for each player.

Can you post some actual code how your Player1 / 2 class looks like? Do they even contain methods / properties or only fields?