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 strings.bank, 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 strings.bank.

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 strings.bank 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()}");
}
else
{
    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 Bank.strings.bank from the AssetBundle. FMOD picks up on the fact that this strings.bank 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 Bank.strings.bank 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 Bank.strings.bank 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 Bank.strings.bank and then loading the strings.bank 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 + strings.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.