|
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.
(comments are locked)
|
|
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.
(comments are locked)
|
|
the best way to do it is using PlayerPrefs read the link here code snippet: PlayerPrefs.SetInt("player",1); loading it if(PlayerPrefs.GetInt("player")==1) .... http://unity3d.com/support/documentation/ScriptReference/PlayerPrefs.html
(comments are locked)
|
