Friday, February 8, 2019

Unity 3d make Pause menu full script by allunityscripts

Pause Menu Script

unity 3d pause menu script


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

public class PauseMenu : MonoBehaviour
{

    public static bool GameIsPaused = false;
    public GameObject PauseMenuUI;

    // Update is called once per frame
    // void Update()

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (GameIsPaused)
            {
                Resume();
            }
            else
            {
                Pause();
            }
        }
    }

    void Resume()
    {
        PauseMenuUI.SetActive(false);
        Time.timeScale = 1f;
        GameIsPaused = false;
    }
    void Pause()
    {
        PauseMenuUI.SetActive(true);
        Time.timeScale = 0f;
        GameIsPaused = true;
    }
    public void LoadMenu()
    {
        Time.timeScale = 1f;
        SceneManager.LoadScene("main");
    }
    public void QuitGame()
    {
        Debug.Log("Quit!");
        Application.Quit();
    }
    public void LoadLevel()
    {
        Application.LoadLevel(Application.loadedLevel);
    }
    public void OpenPanel()
    {
        if (PauseMenuUI != null)
        {
            PauseMenuUI.SetActive(true);
            if (GameIsPaused)
            {
                Resume();
            }
            else
            {
                Pause();
            }
        }
    }
}


2 comments:

  1. I read your post when it was fresh. I stumbled on this link again while searching for something else. Since this appears to be favored by Google it is worth pointing out MS has changed its mind.

    Technology Company that provides certifications solutions and exams for cloud platforms virtualization and mores that empowers users to operate on an assortment of devices. Citrix products are XenMobile, XenDesktop, ShareFile, XenApp and NetScaler. Nearly 100 millions of consumers use Citrix products globally. Citrix Duties are made to reflect the requirements of IT Professionals and associations.
    KILLERDUMPS offers its IT Assessment Dump Files and Practice Test Simulator on cost with 100 percent Guaranteed Success. We provide constant after sale service for Citrix Answer Files and Question and Practice Software to counter any inconvenience.

    You can get Citrix Exam Dumps

    ReplyDelete
  2. This is brackeys picture but the color is changed

    ReplyDelete