By putting the AudioMixer in an Addressable Group we reduced the “instance” count to 2, but it seems to continue to provoke sound bugs.
Any know issues or workaround ?
This bug occurs at least on : Unity 2018.4.15f1, 2018.4.17f1 with Addressables version is 1.6.2
To give more information, we have multiple scenes, when the first scene is loaded, only one audiomixer is loaded, but after loading a second scene the second audiomixer is loaded. An interesting test I made was to bind the AudioMixer in object in each scenes. The one on the first scene looks normal but the one in the second one does not seem to be right.
AudioMixerBug.zip is a repro case for the bug here is the step :
I also tested it on 2019.3.3f1 and at first I thought I didn’t have the bug, BUT the strange binding problem persist but that is true that in that repro, I don’t have the double mixer visually anymore.
I experience the same problem (Unity 2019.4.30f, Win10), I’ve got two AudioMixers instantiated. In the first scene there is only one mixer, on the second I get two. Interestingly, all audio is routed through the mixer that can not be edited via “Edit in Play Mode” button. Additionally most content (including AudioSources) reside in AssetBundles in my case. I wonder how the AudioMixer is instantiated internally? To me it looks like one mixer is loaded as a dependency from the asset bundle but the other one is somehow loaded by default (maybe with the AudioListener?).
Any idea how to work around this problem?
+1, I’m having this issue on build. In Editor, it works correctly, I have only one Mixer instance. But in Build, there is two and it causes some problems like, if I change a parameter in mixer, the other copy mixer is not affected by the change of that. (We are using IL2CPP for build.)
I also ran into this problem. It looks like we need some kind of GLOBAL mixer for the block, which will always and will not depend on Addressable. Otherwise, this whole system with mixers becomes absolutely useless in conjunction with Addressable.
The saddest thing is that I spent a huge amount of time searching for the bug myself, at a time when it was a known problem. Such problems should be explicitly documented, otherwise you are just mocking your developers. This is absolutely not a clear violation of the logic of the workflow.
This was a pain to fix and after spending some time here’s the easiest “fix”.
Note, we didn’t want to make our scenes addressables as this would have changed the workflow for our entire project.
Our project uses Addressables for levels and enemies, but the scenes, ui, etc are not addressables.
Create a singleton to store your audio mixer.
In the singleton, you can either load the AudioMixer as an addressable or choose to use the scene reference.
Choose one of the following:
If you choose to use Addressables (i.e. AssetReference), then you should add a component to every scene AudioSource to set the mixer group at runtime.
If you choose to use the scene reference audio mixer, then you should add a component to every Addressable prefab that has an audio source to set the mixer group at runtime.
We went with using the scene reference to the AudioMixer as there was many more AudioSource in scenes to set the group for then there were Addressables. So the idea is to update the addressable AudioSource mixer group to the group from the scene reference at runtime.