Help with character switching

im about to start a game where you control a squad but i want to have the player control only one member at a time. how would i make it so when you switch to one it disables input on the others and moves the camera to that guy.

You will need to flag which character you’re controlling. There are lots of ways to do this, but the simplest way (in most cases) is to maintain a global reference to the current player being controlled.

What is the function/property to change the current character though?

It’s up to you to make the system for controlling the character and determining which one is being controlled at any moment in time.

Yes but what is the internal function to control a specific character, when there are multiple in a scene?

There isn’t one. You have to make the control system for your game.

Assuming you have a Player class, have a global reference called something like currentPlayer : Player (name it whatever you want). Assign whichever player you’re controlling to that reference. Then pass all your player controls to the currentPlayer reference.

1 Like

Thank you, I get it now, I misinterpreted the node and got confused by the camera being auto-selected in a scene, and assumed the character was also being auto-selected to sink input.