Hi, actually in my main menu I have one option only, one called "Play", I want now to implement a couple of them "Single player play" and "Two players play". On my main Scene called "TheGame" I have both players, but I want that if I someone clicks on Single Player, the object of my second player disapears. Anyone knows what I have to do? Here I have attached the script of the button "Play" on my Main menu
Hope you can help me, thanks.
asked May 13 '11 at 10:39 AM
You could have a "GameManager" object which holds a variable for the number of players. Just be sure to have this in a script attached to it:
This way the object won't get destroyed between scenes.
When the player clicks the Single Player button just set the number of players variable to 2. From there when you load the next scene you can check the number of players (probably in your Awake or Start function) and do whatever you need to with destroying/creating players.
answered May 13 '11 at 11:46 AM
the best way to do it is using PlayerPrefs
read the link here
answered May 16 '11 at 07:10 PM