- Home /
How to switch between different characters in real time?
I think this is easy one, but I'm still asking for advice. So, I'm making a 2D platformer, and I have several player characters, each one is individual game object, with their own sprites, animations, scripts etc. I want that player can choose between those characters in real time, for example, number keys are switch keys, and by pressing certain number key (e.g. '1'), player could choose which characters he wants to use.
My idea is next: All characters are prefabs, I would have one game controller object with script that checks for player input (for switching between characters), and if certain key is pressed, current player game object would be destroyed, and desired character would be instantiated. I think that functions Destroy() and Instantiate() are most suitable for this.
I did not test this yet, but I will. What do you think? Will this work? And if will, is this the best way to do this? If not why not?
Thanks in advance. :)
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Parenting player to car on click. 1 Answer
Scripting help 1 Answer
Problem with player movements 1 Answer