Community Q&A

Where Wwise users help each other out!

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

Changing scene in Unity

0 votes

Hi guys,

I have some questions regarding scene changes in Unity.

The first is: What is the best practice to ensure that sounds are being stopped when changing scene?
When I change scene, I often get the log message in the Wwise profiler that "Sound with positioning enabled is not attached to any listener, will use virtual voice setting."
And then if virtual voice settings is not kill, then it will not be stopped even though that the game object associated with that voice in Unity has actually been destroyed.

The second is: If I actually want some sound to continue across scene changes (without interruption) how do I do that?
Do I have to associate that sound with a separate listener, that is not destroyed on scene changes?

The third is: How do I handle loading/unloading of soundbanks when changing scene if the same sound bank is used in both scenes?
I understand that ideally you would not unload a sound bank on Destroy in the previous scene if you want to use it in the next one, but then you would need some bigger system keeping track on which sound banks are used in which scenes. And it seems that right now that if the bank is asked to be unloaded on Destroy in the previous scene and loaded on Awake or Start in the next scene, then the new load request will actually come before the bank is fully unloaded. This results in that Wwise will say that the bank is already loaded after which the bank will complete its unload request from the previous scene which in turn means that the bank is not loaded when the events using it are triggered. The funny thing is that Wwise will not say that the bank is already loaded in the new scene if I don't give it the unload request on Destroy in the previous one...

Sorry for this bulk of questions at the same time, but I feel that they are related and that it somehow makes sense to ask them together.

Best, Jakob

asked Aug 17 in General Discussion by Jakob Hougaard Andersen (160 points)

1 Answer

+1 vote

Hey Jakob,
I'll try to make it short. 

What is the best practice to ensure that sounds are being stopped when changing scene?
Make sure the SoundBank for that scene is stopped on Destroy and then all sounds related to that SoundBank should be stopped on destroy as well. But it sounds like you've got that covered. 

If I actually want some sound to continue across scene changes (without interruption) how do I do that?
- Have you checked out Media Relocation? As long as you've loaded a second SoundBank with that sound in it as well, you can just re-parent the game object you posted it on into the new scene, and it will continue playing despite unloading the first SoundBank. 

How do I handle loading/unloading of soundbanks when changing scene if the same sound bank is used in both scenes?
- I would probably have a new SoundBank for each scene instead of using one SoundBank for multiple, so that the audio is separated just like the game is structured. If you have to load the same SoundBank in a new scene, you might want to make a custom system that loads the SoundBanks and keeps track of them. Like a manager, that loads / unloads the SoundBanks, but only if it receives a new SoundBank request from a scene. 

Have you tried Wwise Adventure Game? If not, you should try download it from the Wwise Launcher and see if that method is anything that fits into your game. If it does fit, it's always a good reference sheet if you head into problems in your own game, or if you want to test something before you do the actual implementation in your game. 

Hope this helps! 

answered Aug 20 by Mads Maretty S. (Audiokinetic) (1,120 points)
Hi Mads
Thanks for your answer.
I will check out Wwise Adventure Game.
...