diff --git a/Assets/GothicVR-Lab/Scripts/Handler/LabMusicHandler.cs b/Assets/GothicVR-Lab/Scripts/Handler/LabMusicHandler.cs index 552140c88..471dc937c 100644 --- a/Assets/GothicVR-Lab/Scripts/Handler/LabMusicHandler.cs +++ b/Assets/GothicVR-Lab/Scripts/Handler/LabMusicHandler.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using GVR.Debugging; using GVR.Manager; using TMPro; using UnityEngine; @@ -26,7 +27,14 @@ public void Bootstrap() public void MusicPlayClick() { - MusicManager.I.SetMusic(fileSelector.itemText.text, themeSelector.itemText.text); + MusicManager.I.SetEnabled(true); + FeatureFlags.I.enableMusic = true; + FeatureFlags.I.showMusicLogs = true; + + var fileSelect = fileSelector.options[fileSelector.value].text; + var themeSelect = fileSelector.options[fileSelector.value].text; + + MusicManager.I.SetMusic(fileSelect, themeSelect); } } } diff --git a/Assets/GothicVR/Scripts/Manager/MusicManager.cs b/Assets/GothicVR/Scripts/Manager/MusicManager.cs index 3dc8ef490..1f8f59046 100644 --- a/Assets/GothicVR/Scripts/Manager/MusicManager.cs +++ b/Assets/GothicVR/Scripts/Manager/MusicManager.cs @@ -16,6 +16,7 @@ public class MusicManager : SingletonBehaviour private IntPtr music; private IntPtr directmusic; + [Flags] public enum Tags : byte { Day = 0, @@ -49,7 +50,7 @@ public enum Tags : byte private void Start() { var backgroundMusic = GameObject.Find("BackgroundMusic"); - backgroundMusic.TryGetComponent(out musicSource); + backgroundMusic.TryGetComponent(out musicSource); } @@ -207,6 +208,10 @@ public void SetMusic(string segment, string themeName) { var theme = AssetCache.TryGetMusic(themeName); + reloadTheme = true; + pendingTheme = theme; + hasPending = true; + if (FeatureFlags.I.showMusicLogs) Debug.Log($"Playing music: theme >{themeName}< from file >{theme.File}<"); }