Пример #1
0
    // Update is called once per frame
    public void SoundON()
    {
        SoundONButton.GetComponent <Image> ().enabled  = true;
        SoundOFFButton.GetComponent <Image> ().enabled = false;
        GameObject BackgroundMusic = GameObject.FindGameObjectWithTag("BackgroundMusic");

        AudioListener.volume = 1;
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        GameObject BackgroundMusic = GameObject.FindGameObjectWithTag("BackgroundMusic");

        if (AudioListener.volume != 0)
        {
            SoundONButton.GetComponent <Image> ().enabled  = true;
            SoundOFFButton.GetComponent <Image> ().enabled = false;
        }
        else
        {
            SoundONButton.GetComponent <Image> ().enabled  = false;
            SoundOFFButton.GetComponent <Image> ().enabled = true;
        }
        DontDestroyOnLoad(gameObject);
    }