Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (AudioPlayer)
        {
            AudioPlayer.SetVolume(volumeSlide.value);
        }
        else
        {
            Debug.LogWarning("no music Player attached");
        }


        if (Input.GetKeyDown(KeyCode.Escape) && flag == false)
        {
            transform.GetChild(0).gameObject.SetActive(true);
            Time.timeScale = 0;
            flag           = true;
        }
        else if (Input.GetKeyDown(KeyCode.Escape) && flag == true)
        {
            transform.GetChild(0).gameObject.SetActive(false);
            PlayerPrefsControler.SetMasterVolume(volumeSlide.value);
            PlayerPrefsControler.SetDifficulty(difficultySlide.value);

            Time.timeScale = 1;
            flag           = false;
        }
    }
 public void SaveAndExit()
 {
     PlayerPrefsControler.SetMasterVolume(volumeSlide.value);
     PlayerPrefsControler.SetDifficulty(difficultySlide.value);
     FindObjectOfType <LevelLoader>().LoadMainMenu();
 }