Issues with playing sounds from Asset Bundles

Hey folks!

I’m having some difficulty with playing sounds from a downloaded Asset Bundle in our app, and I’m sort of at a loss as to what the issue could be. Right off the bat I want to say that we are probably using a less than common set up for our banks, but our sound designer doesn’t think this would be the cause of the issue.

As it stands, we have various banks for each Asset Bundle “pack.” Each pack contains a number of 3D assets which are loaded into our app, as well as our banks, which are stored on a prefab that loads the banks into memory when instantiated. We have each corresponding bank marked as a master bank in FMOD Studio so that they could then have a respective, allowing us to load the path strings for a specific pack’s bank only when the user is using that pack. This should also allow us to update the banks by updating the Asset Bundle, rather than having to issue an update to our Master Bank and it’s corresponding

Furthermore, we have some globally used UI sounds in our Master Bank, which is included in all builds of the app. These UI sounds work as expected, and our sound designer has said that these sounds are sent straight to our Master Bus.

When loading the bank and from the Asset Bundle, both load in correctly, but whenever the GameObject that contains a StudioEventEmitter is enabled, the allocated sound doesn’t audibly play. Interestingly though, FMOD doesn’t throw an error here saying that it can’t find the event by the supplied path and I can see the StudioEventEmitter.Play() method is being called.

I also created a little utility class that I can throw on the GameObject at runtime, and it states that the StudioEventEmitter.IsPlaying() value is true:

StudioEventEmitter eventEmitter = GetComponent<StudioEventEmitter>();
if (eventEmitter != null)
    Debug.Log($"Event emitter playing? {eventEmitter.IsPlaying()}");
    Debug.Log("Could not find event emitter");

I experimented by unmarking the banks as Master except for the Master Bank, and then loading in the bank by itself with the Master from the AssetBundle. FMOD picks up on the fact that this has already been loaded, and does not load it, but when the GameObject is enabled, FMOD throws an error at this point saying it can’t find the event. This seems quite strange, because the Master included with the app should have reference to all our events.

EDIT: I just realized that the above paragraph isn’t actually an issue, what would be happening here is that the because the Master was made when all banks have been marked as master and then loaded directly into Unity and not via Asset Bundle, it wouldn’t have references to the other banks (which is expected behaviour).

Furthermore, I’ve also experimented with unloading the already loaded Master and then loading the from the AssetBundle. Interestingly, FMOD does not throw the above error, but the sound still does not play. I would say this scenario lines up with the first in this message.

At this stage it doesn’t feel like an issue with loading in banks, and might be an issue with our set up? As far as I can tell, our workflow of having distinct master-marked banks is not an intended way to use banks. Looking at some of the documentation, the Master Bank is meant to contain the mixer for the FMOD project, so I wonder if this might be getting messed up by our method. Admittedly this is where my knowledge starts to get hazy, but our sound designer didn’t think this would be an issue and recommended we use the “every bank is a master bank” method.

Thanks for reading my long post, hoping someone experienced with this could give me a helping hand! Appreciate it (:

Okay, so I’ve been doing a bit of testing throughout today and have a bit more information to provide.

Firstly, I noticed after reenabling the FMOD Debug Overlay that when the sound was said to be playing (see the small class I included in the original post), the channels in use would increase, but the volume would remain at -80.00db. So I could see some action occurring within FMOD and coupled with StudioEventEmitter.IsPlaying() returning true, I believed that it was finding and trying to play the event correctly.

Next, in order to test the sounds themselves, I imported the bank manually into our main app Unity project (our bundling process is handled by a different project). What I found was that the original sound (an ambience) was not being played even when manually loading the bank via the same StudioBankLoader that initially loads our Master Bank + However, after this, I tried playing the ambience from the FMOD Event Browser, which does work. I then attempted to play one of our sound effects from within the app, which worked.

After seeing this behaviour, I created a new Asset Bundle playing the sound effect that worked. The sound effect successfully played in the app after the bank was imported from the Asset Bundle. So now it seems like a process of figuring out why the ambience is not being played, while the sound effect is.

Our ambiences are sent to a group named Global, which is intended to send sounds to a specific type of user, while our sound effects are sent to a group named Personal, which much in the same way should send sounds to a different type of user. Could there be some sort of discrepancy in the way these have been set up that could be causing Global sounds not to play, while Personal sounds do? We haven’t actually implemented a way of sending specific sounds from specific groups to those specific types of users yet, so I assume that isn’t the issue.

What versions of FMOD and Unity are you using?
Are you able to connect the FMOD Studio Profiler to the game, this may help to see what each event is doing.

Apologies for lack of response, had a scheduled week off :smiley: Thanks for giving some next possible steps!

We are using FMOD 2.01.01 and Unity 2019.2.17f1. I will try connecting the profiler and return back with any results.

EDIT: I’ve just done some testing using the Profiler. I’m not sure what to make of the results, I haven’t used the Profiler before. In fact I don’t know if the Profiler is 100% helpful in my situation based on what happened when I connected with Live Update.

When not hooked up to Live Update, the ambience we’re trying to play doesn’t work, as explained before. However, as soon as Live Update is on, the ambience begins playing, and I can see it playing in the Mixer of FMOD Studio. If I then turn Live Update off, the ambience continues to play properly, and plays properly whenever triggered. It appears to work for the lifetime of the app. Even if I haven’t actually played the ambience yet, as long as I’ve at least connected Live Update at some stage in the app lifetime, the ambience seems to work correctly.

As a side note, I’m also noticing that the sound effect that we are testing appears to be played on the “Personal” group (as expected), but also seems to play on the “Global” group as well, despite not being routed to that group. Unsure why this would be.

Interestingly, I can actually get the ambience to “play” without actually outputting audio while connected to FMOD Studio using Live Update by doing the following:

  • Connect to Unity via Live Update
  • Play a sound effect from FMOD Studio directly
  • Go to scene and play ambience
  • Ambience in FMOD Studio Mixer appears to only play on AMB group, is not routed to Global or Master

I’m unsure whether this represents what’s actually happening without any connection to FMOD Studio, but it’s the most I have to go off at this current point in time. I’ve recorded a 15 second session using the Profiler and I’m going to see if I can glean anything from the information.

It looks like you are also using the Resonance Audio plugin and this could be contributing to the strange behavior. From the shot of the mixer view, it looks like you have two Resonance Audio Listeners which means that any event with a Resonance Audio Source will send to both of them. See the Resonance Audio docs for more info.

Interesting. I’ll have to investigate that with our sound designer and see what we can find. Thanks for your response Cameron!

So, we’ve had a look at our usage of the Resonance Audio Listener to see if we can figure out if anything might be going wrong there. Unfortunately, after a range of further testing, we are almost more confused as to what the issue could be.

  • Our sound designer built some banks that remove the usage of the Resonance Audio Listener on our Global and Personal groups and instead have it placed on the Master bus. The ambience did not work when we tested these new banks.
  • Our sound designer has a separate Unity project that he uses to streamline his testing process for our assets. He had not come across any isses with the ambience in question, which is why we hadn’t noticed this until now, and when I tested the ambience in that project, it worked fine (hence, I don’t think this is an issue with my computer).
  • This separate Unity project had slightly different FMOD settings to the main app project, so I changed everything to match and still, the ambience works in that separate project.
  • Back in our main app project, we tested out some other sounds that utilize streaming (like our ambience that isn’t playing). All the sounds we tested work fine.
  • I created a fresh scene in our main app project and set up the appropriate banks to load in and the ambience to play. The ambience didn’t work in this scene either.
  • Most of this work has been on a Windows PC, but I have access to a Macbook Pro, so I tested the same project (and same source control branch) on the Macbook and got the same result, the ambience did not play. The other sounds that were working, also worked on the Macbook.
  • I (probably somewhat foolishly) hadn’t tested on device yet, so I made an iPhone build and tested on my iPhone 8 Plus. The ambience works fine on the device.

At this point it seems like we can narrow down the issue to being something specifically to do with our main app project in the Unity Editor, but we’re pretty unsure where we could even start with trying to figure out the problem. Any possible guidance would be really appreciated, but we even figure this is something that hasn’t been seen by any of the FMOD team! :sweat_smile:

At this point we might even have to play every sound in our banks to see if they work. If we’re able to find multiple that don’t, we could potentially crossreference them and determine if there are any similarities between them, though with a pretty expansive library, this might be quite time consuming. :grimacing:

Ok, first thing to do with the setup you mentioned above would be to check the editor log (after trying to play the scene with the ambience that doesn’t work).

If there is nothing obvious in that, change the FMOD logging level to LOG in the settings and see if that provides anything more useful.

I can take a look through the logs if nothing stands out to you.

Thanks for the response and guidance Cameron.
Apologies for the length of this post, today has been a bit of a trip and I’ve had to continue adding to this because the behaviour that is coming from FMOD and Unity does not appear regular at all.

I jumped back on to look through the Editor logs as suggested, and some definite further strangeness occurred.

  • One of our SFX that was working last week during testing was no longer working in the test scene I set up. Similarly to the ambience that has not been working, my utility script says it’s playing, but I cannot get it to play by connecting to FMOD Studio via Live Update.
  • I tried out the ambience and it worked. However, I can’t guarantee that I wasn’t connected to FMOD Studio via Live Update at this time, it may have been and didn’t realize - I was pretty perplexed why the aforementioned SFX was no longer working. On subsequent tests, the ambience was no longer working.
  • Another ambience in the same bank was no longer working despite working last week. In contrast to the SFX not working above, I am able to get it playing when connected to FMOD Studio via Live Update.

I have no idea what would have changed but I know for a fact that these events were playing last week.

I was looking through logs, and since nothing particularly stood out, I was in the process of collating them in order to upload here. However after this, I began running into another issue where I couldn’t seem to end play mode without a ton of errors being thrown from FMOD. This was happening every time I stopped play mode after playing an event, no matter what the event was.

Furthermore, I was unable to start play mode again. Attempting so would cause Unity to hang indefinitely, and even attempting to close the program would cause it to hang. On subsequent tests using different events, sometimes Unity would crash immediately when exiting play mode. It seems like the SFX do not crash Unity when exiting play mode, but if an ambience has been played, Unity does crash.

EDIT: Managed to figure out that because I was loading in the Master Bank (+ the Master in my test scene, this was what was crashing Unity. However I have no idea why that would be the case.

I’ve attached four Editor.log files:

HF_AlcShop_AMB_Master.log (352.1 KB) - The ambience that has been the main subject of this thread.
HF_City_AMB_Master.log (254.9 KB) - The ambience playing last week that has somehow stopped working.
HF_CursedObject.log (209.3 KB) - The SFX that has somehow stopped working.
HF_FireBottleTrap.log (208.5 KB) - An example of a SFX that is playing correctly in Unity.

Each log is taken after opening up our main app project, playing the testing scene, pressing the Enable button on the UI to set the Emitter GameObject to active (the Studio Event Emitter is set to Play Event on Object Enable), waiting some time, pressing the Disable button on the UI (setting it no longer active and stopping the event) and then ending Play Mode.

Could you please confirm whether you, or anyone else on the FMOD team, has seen an issue like this before Cameron?

Are there any possible nuclear options we can go to here? I feel like none of this behaviour makes any sense and truthfully from a company perspective this is beginning to drain resources as there has been little progress on my work in over a week. (Which I don’t blame anyone in particular for, just stating the additional pressures of my job)

I couldn’t see anything that looked out of place in any of those log files.

It doesn’t look like something we have come across before, although we still are not sure what is exactly causing this.

Here are a number of things you can try (that get progressively larger scale):

  • Update to the latest version of 2.01.xx. (We also have another version due out at the beginning of November.)
  • Manually delete the FMODStudioCache.asset & FMODStudioSettings.asset files.
  • Record a session with Studio Profiler that you can share with us to look deeper into.
  • See if you can reproduce any of this in a new empty project.
  • Manually delete the FMOD plugin folder (from explorer while Unity is closed) then reimport the FMOD unitypackage.

Thanks for that Cameron, we really appreciate your guidance and patience with our issue! I’ll give some (if not all) of these a go today, fingers crossed we can see some result.

:upside_down_face: So it seems like the solution to the issue was quite simple… Yesterday I managed to reproduce the issue in an empty project (meaning it actually wasn’t a project-based issue), so I then upgraded FMOD Studio and that project to 2.01.05 and after re-building the banks, the ambience began playing.

Admittedly I probably should have thought to attempt upgrading earlier, but we have to upgrade three different projects in our pipeline plus FMOD Studio across several environments, which is why I held off until it was suggested. Oh well, lesson learned I suppose…

Cameron, if you’re at all interested then I have that new project with FMOD 2.01.01 which has issues and can send it through if needed to diagnose the issue, but I assume at this stage it’s probably easier to just tell people who might have this issue in future that they should upgrade.

Thanks again for your help, much appreciated!

Glad to hear you found a solution, I guess this can be one of the problems with having early access versions.

If you would like to share the project I can take a look, just to make sure we understand the cause of it. You can upload it to your profile: