/// <summary> /// ボリュームの設定 /// </summary> /// <param name="soundCategory">サウンドカテゴリ</param> /// <param name="volume">ボリューム (0-1)</param> public void SetVolume(SoundCategory soundCategory, float volume) { string volumeName = null; switch (soundCategory) { case SoundCategory.Master: volumeName = MasterVolumeName; break; case SoundCategory.Bgm: volumeName = BgmVolumeName; break; case SoundCategory.Se: volumeName = SeVolumeName; break; case SoundCategory.Voice: volumeName = VoiceVolumeName; break; default: Debug.LogWarning($"Invalid SoundCategory. [soundCategory={soundCategory}]"); break; } if (!string.IsNullOrEmpty(volumeName)) { float dbVolume = SoundUtil.CalcGetVolumeToDb(volume); audioMixer.SetFloat(volumeName, dbVolume); } }