public static void SaveVolume(AudioMixerGroupNames audioMixerGroupName, float volume)
        {
            string playerPrefsKey = string.Format("{0}_AudioSource_Volume", audioMixerGroupName.ToString());

            PlayerPrefs.SetFloat(playerPrefsKey, volume);

            if (VolumesDict.ContainsKey(audioMixerGroupName))
            {
                VolumesDict[audioMixerGroupName] = volume;
            }
            else
            {
                VolumesDict.Add(audioMixerGroupName, volume);
            }

            //Debug.Log("SAVE: " + playerPrefsKey + " = " + VolumesDict[audioSourceType]);

            if (OnVolumeChanged_Action != null)
            {
                OnVolumeChanged_Action(audioMixerGroupName, volume);
            }
        }
Пример #2
0
        private AudioMixerGroup GetAudioMixerGroupByName(AudioMixerGroupNames audioMixerGroupName)
        {
            AudioMixerGroup audioMixerGroup = MasterAudioMixer.FindMatchingGroups("Master").FirstOrDefault(x => x.name.Equals(audioMixerGroupName.ToString()));

            return(audioMixerGroup);
        }