I’m trying to make on-demand Bank loading for a Unity project for WebGL.
I have read the following article:
These articles use a
while loop to wait for the Bank to finish loading, but apparently this is not flexible enough.
For example, I have two Events that need to be played and they belong to different Banks. I want the Event to start playing as soon as the Bank it needs is loaded, whereas using the
HaveAllBanksLoaded() method means that I have to wait for all the Banks to finish loading before I can play the Event.
It seems like adding a callback function to the LoadBank method would be a good way to do this, but it would require me to make some changes to the RuntimeManager code, and handling this part of the functionality could become cumbersome if and when we subsequently update the version of the FMOD Unity integration.
Other than that, is there a better way for me to accomplish this?
Also, I found a line of code in the RegisterLoadedBank method in the RuntimeManager that looks like this:
According to the C# documentation, the
Add method of a Dictionary throws an exception if the same value is passed in.
And before that, only the
Instance.loadedBanks.ContainsKey(bankId) check was passed at the beginning of the
LoadBank() method. And the execution of
RegisterLoadedBank() method in
loadFromWeb() method is after
yield return www.SendWebRequest();. Is this likely to trigger an exception due to asynchronous loading?