// Start is called before the first frame update
    void Start()
    {
        muteToggle    = GetComponent <Toggle>();
        musicAssigner = FindObjectOfType <MusicAssigner>();

        AudioListener.pause = musicAssigner.isMuted;
        //Add listener for when the state of the Toggle changes, to take action
        muteToggle.onValueChanged.AddListener(delegate {
            MuteToggleValueChanged(muteToggle);
        });
    }
Example #2
0
 void Start()
 {
     if (Instance == null)
     {
         Instance = this;
         GameObject.Find("/Player").GetComponentInChildren <AudioControl>().PlayBGM(music);
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }