feat: music volume (#52)

This commit is contained in:
2025-03-31 14:44:20 +02:00
committed by GitHub
parent 0d9c0a8362
commit 20b82fe6a9
8 changed files with 580 additions and 18 deletions

View File

@ -16,6 +16,16 @@ public class LevelLoader : MonoBehaviour
private void LoadAudio()
{
audioSource.clip = Resources.Load<AudioClip>(Path.Combine("Musics", levelsLoader.levelCurrent.musicName));
if (PlayerPrefs.HasKey("Volume"))
{
audioSource.volume = PlayerPrefs.GetFloat("Volume");
}
else
{
audioSource.volume = 1f;
}
audioSource.Play();
}