Added audio files to list of loaded assets

This commit is contained in:
katboi01
2025-08-01 22:35:33 +02:00
parent d9b4686275
commit 37cd7d2ee3
5 changed files with 94 additions and 49 deletions
+20 -7
View File
@@ -21,10 +21,8 @@ public class UmaViewerBuilder : MonoBehaviour
static UmaViewerUI UI => UmaViewerUI.Instance;
static UISettingsModel ModelSettings => UmaViewerUI.Instance.ModelSettings;
public List<AssetBundle> Loaded;
public List<Shader> ShaderList = new List<Shader>();
public Material TransMaterialCharas;
public Material TransMaterialProps;
public UmaContainerCharacter CurrentUMAContainer;
public UmaContainer CurrentOtherContainer;
@@ -761,12 +759,12 @@ public class UmaViewerBuilder : MonoBehaviour
public void LoadLiveSound(int songid, UmaDatabaseEntry SongAwb, bool needLyrics = true)
{
CurrentLiveSoundAWBIndex = -1; // mix awb together
CurrentLiveSoundAWB.Clear();
ClearLiveSounds();
//load character voice
if (SongAwb != null)
{
PlaySound(SongAwb);
CurrentLiveSoundAWB.Add(SongAwb);
AddLiveSound(SongAwb);
}
//load BG
@@ -778,7 +776,7 @@ public class UmaViewerBuilder : MonoBehaviour
if (BGclip.Count > 0)
{
AddAudioSource(BGclip[0]);
CurrentLiveSoundAWB.Add(BGawb);
AddLiveSound(BGawb);
}
}
@@ -824,8 +822,8 @@ public class UmaViewerBuilder : MonoBehaviour
public void SetLastAudio(UmaDatabaseEntry AudioAwb, int index)
{
CurrentLiveSoundAWB.Clear();
CurrentLiveSoundAWB.Add(AudioAwb);
ClearLiveSounds();
AddLiveSound(AudioAwb);
CurrentLiveSoundAWBIndex = index;
}
@@ -1086,4 +1084,19 @@ public class UmaViewerBuilder : MonoBehaviour
AnimationCamera.fieldOfView = fov;
}
}
private void AddLiveSound(UmaDatabaseEntry entry)
{
UmaAssetManager.LoadAssetBundle(entry, false, false);
CurrentLiveSoundAWB.Add(entry);
}
private void ClearLiveSounds()
{
foreach (var liveSound in CurrentLiveSoundAWB)
{
UmaAssetManager.UnloadAssetBundle(liveSound, true);
}
CurrentLiveSoundAWB.Clear();
}
}