Saturday, February 2, 2019

How to make Main Menu in unity ( full script) by allunityscripts

  Main Menu Script

Hi friends, In this post i have show you how to make main menu in our game that is very easy to make main menu using our script.In this script i create two custom function

Custom Function

  1. Play Game
  2. Quit Game

Play Game 

play function represent to play game .You just click on play button and next scene is active on your game.Next scene active depend on your " Build Index " .

Quit Game

Quit function represent to quit game .You just click on quit button and game is quit.and "Debug.Log ("QUIT!");" is represent to your script is correctly running in your editor.If you click on quit button and check on unity console message is slow "quit game"

Also check

if you want to make level selection in your game in give link in down please visit this post

how to make main menu in unity 3d full script





using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Mainmenu : MonoBehaviour {

    public GameObject LoadingImage;
public void PlayGame ()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        LoadingImage.SetActive(true);
}
public void QuitGame ()
{
Debug.Log ("QUIT!");
Application.Quit();
}
}




// I hope you like this if like please share this for your friends



2 comments: