Adding a main menu button to the startScene
We will create a main menu button, so that we can press it to go to the MainMenu scene when we select it. To do this, we will create a new button and name it mainMenuBtn
. Position the mainMenuBtn
so that it is to the left of the middle of the screen.
Also select the homeBtn2
option as the Source Image
in the Image (Script)
section; and leave the rest of the values set to their defaults:
Like the reset button, we can only show the main menu button once the game is over. So, in gameScript
, create a new public variable called mainMenuButton
, shown as following:
public Button resetButton;
public Button mainMenuButton;
public Toggle pauseButton;
Set the active status of the mainMenuButton
to false
in the Start
function:
// Use this for initialization void Start () { GameObject player = GameObject.Find("theDude"); pScript = player.GetComponent<playerScript>(); GameObject enemy = GameObject.Find("Enemy...