Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

WWise audio events aren't playing after resetting the scene in Unity

+4 votes
Hello. I have a Unity scene that I allow the user to reset by reloading the same scene, using the following code...

SceneManager.LoadScene(SceneManager.GetActiveScene().name);

This should reset all the objects in the scene and start it from the beginning. The first time the scene is started, the WWise audio events work fine, but as soon as the scene is reset using the code above, the WWise audio events no longer work. Your thoughts?

I checked the Unity Editor logs and all the WWise-related entries look fine. Are there any other logs I can inspect to give me some kind of indication of what's wrong?

Thanks in advance for your help!
asked Feb 28, 2017 in General Discussion by Joe C. (140 points)

Also have this issue using Unity 5.5.2 with the latest Wwise integration. Would love to find a solution to this. Perhaps there is an alternate way to reset the scene?

Having the same issue myself.  Thought it could have been something to do with soundbanks not unloading/loading properly when the scene is restarted as I was getting an error saying that soundbanks couldn't be loaded as they were already loaded.  

I've tried creating a 'loading game screen' scene where the soundbanks will load on a DontDestroyOnLoad object, meaning they should only load once before the level loads and then persist. However, when restarting the scene I get no audio from those banks but no error messages either.  My UI audio in another soundbank (loaded in the same way but at the very first scene) persists and works after the level scene is restarted.  Not sure what else to try.
I found a fix.
Error: that happens because the soundbanks are unloaded right after they are loaded.
Fix:
Go to the WwiseGlobal GameObject that was created on your scene (sometimes it is created on playmode, if so, copy this gameobject during the playmode and paste on edit mode)
You gonna have a script attached to this gameobject called Ak Bank.
Set: Load On > Start
Set: Unload On > Nothing

Before reseting your scene or opening a new one call StopAll on your script to stop all the sounds, if needed. Something like:

        AkSoundEngine.StopAll();
        SceneManager.LoadScene("YOURSCENE", LoadSceneMode.Single);

1 Answer

0 votes
any errors in console?
answered Mar 10, 2017 by Ratko F. (290 points)
...