Skip to content

Instantly share code, notes, and snippets.

@JohannesMP

JohannesMP/Example.cs Secret

Last active Nov 11, 2020
Embed
What would you like to do?
// Called when a change in AkSoundEngine.GetCurrentLanguage() is detected
private void OnLanguageChange()
{
const string bankName = "VO_SoundBank";
if(_reloadBankRoutine == null)
{
_reloadBankRoutine = StartCoroutine(ReloadBank(bankName));
{
}
private Coroutine _reloadBankRoutine;
private IEnumerator ReloadBank(string bankName)
{
AkBankManager.UnloadBank(bankName);
yield return null;
bool loadIsDone = false;
AkBankManager.LoadBankAsync(bankName, (id, ptr, result, cookie) =>
{
loadIsDone = true;
});
while (!loadIsDone)
{
yield return null;
}
Debug.Log($"Bank {bankName} has been reloaded");
_reloadBankRoutine = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment