I’m loading Fmod banks manually when loading a level. The problem is that loading is not async and consumes 700ms in one frame causing the game to drop FPS significantly. This is my code for loading the banks async that doesn’t work as expected. Could someone please help what can be done to get this fixed:
using System.Collections;
using System.Collections.Generic;
using FMODUnity;
using UnityEngine;
public class FmodBankLoader : MonoBehaviour
{
[BankRef] [SerializeField] private List<string> banks;
void Start()
{
StartCoroutine(LoadGameAudioAsync());
}
IEnumerator LoadGameAudioAsync()
{
// Iterate all the Studio Banks and start them loading in the background
// including the audio sample data
foreach (var bank in banks)
{
RuntimeManager.LoadBank(bank, true);
}
// Keep yielding the co-routine until all the Bank loading is done
while (RuntimeManager.AnyBankLoading())
{
yield return null;
}
}
public List<string> GetBanks()
{
return banks;
}
}