- Home /
switching between in game characters
i hope someone can help me
I am trying to create an in game character switch
so you control a character and at the press of a button switch to a nearby character. the original still being there
i did create this at one point but it destroyed the original character and they both need to be on screen
i hope i explained clearly and someone can help thanks
Answer by Milad · Jun 23, 2011 at 01:09 PM
One way is you use 2 camera.
When you press the button disable the current camera and enable other camera and vice versa.
I think when you change the character you destroy current character! If you can put your code here!
i can change the camera but i cant change it so the player controls the other character
You must disable the control script of current character and enable the other.it is easy.or set a bool true/false with Send$$anonymous$$essage.
Answer by Chris D · Jun 23, 2011 at 05:19 PM
It would help if you could clarify with a few more details such as the perspective you're using in your game.
If you're doing this in a third-person perspective (i.e. not first person) it would just be a matter of having the camera follow a different transform (that of the new player).
If you're doing this from a first-person perspective, your best bet (as @Milad suggested) is to have one camera per character, positioned as needed, and switch between them depending on who is 'active'.
Either way, to transfer control between characters would be a matter of
disabling Player 1's controls
enabling Player 2's
You'd toggle Behaviour.Enabled for the script you're using to control the character.
Your answer
![](https://koobas.hobune.stream/wayback/20220612115320im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Complex character switching 1 Answer
changing player (getting in vehicles) 3 Answers
Access other gameObject's components in C# script 1 Answer
switch character 1 Answer
Switch between characters and follow? 3 Answers