Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
561 B
5
Indexable
Never
  public void Start()
    {
        SaveMusicData();
    }
    public void SaveMusicData()
    {
        PlayerPrefs.SetInt("MusicOff", MusicOff ? 1 : 0);
    }
    public void Update()
    {
        if (MusicOff = PlayerPrefs.GetInt("MusicOff") != 1)
        {
            AudioSource[] audios = FindObjectsOfType<AudioSource>();
            foreach (AudioSource a in audios)
            {
                a.volume = 0;
            }
        }
        
        if (MusicOff)
        {
            MusicOff = PlayerPrefs.GetInt("MusicOff") == 1;
           ....