Sound not playing in build (unity cloud)

Hello ,

I am using Fmod with Unity 5. The integration has been working really well, we have been testing and using it for several months. We are now trying to use Unity cloud, where before we would run the game mostly locally in the editor and building in each of our computers. In unity cloud however, we get some errors, from missing banks.

We have tried several options already in Unity clould build, and also did a development build to try and figure out what the error might be…we do have some clues, it seems that the banks are not being properly setup to the ones in the project. We already have the setting to use “Single platform buiild”…

attaching some screenshots, maybe it triggers a hint :wink: Thank you for the support and the tool, we love it :clap: :clap: :clap:

There are a couple steps listed at the bottom of https://fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/platforms.html#/

Building from Unity

Whenever Unity is started or the platform is changed, the Integration will copy the Banks for the current platform into the Streaming Assets folder.

If you are building from script BuildPipeline.BuildPlayer() won’t trigger a Bank copy if the target platform is different from the active platform. Use EditorUserBuildSettings.SwitchActiveBuildTarget() to switch to the target platform first.

Hello,

" If you are building from script BuildPipeline.BuildPlayer() won’t trigger a Bank copy if the target platform is different from the active platform. Use EditorUserBuildSettings.SwitchActiveBuildTarget() to switch to the target platform first." where exactly should this be changed? It doesn’t mention in the docs where this is being set unfortunately

Similar to when building using BatchMode from command line, you can create scripts to be called before the build is triggered. https://docs.unity3d.com/Manual/UnityCloudBuildPreAndPostExportMethods.html

Although this does depend on where the bank files are stored, because it will try to copy them over to the streaming assets folder.

A couple of things to note:

  • I would not recommend storing the built banks or the Studio project inside the Assets folder. This will bloat the size of your game as they will be included in the build. Even just having it sit along side the Assets folder is a better option.
  • If you want to skip the copying banks process, you can build the banks directly into the streaming assets folder (make sure it’s not inside a subfolder, eg. Desktop)

Hi @cameron-fmod
I’m having a similar problem and noticed that the StreamingAssets wasn’t updated until I built the unity project locally.

But I have some trouble understanding your recommendations.

  1. “I would not recommend storing the built banks or the Studio project inside the Assets folder”.
    I understand that it’s not a good idea to store the fmod project in the Assets folder, but the banks, how can the game read the assets and play any sounds if they are not included? Don’t they need to be in Assets/StreamableAssets?

  2. “build the banks directly into the streaming assets folder” → How do I build directly into the folder? In the preferences of FMOD 2.02.04 i can only choose a subfolder on Build > Desktop > “Output sub-directory”. If I enter a relative path like “…/spacechef/Assets/StreamingAssets/”, it doesn’t go one level up, it just creates a subfolder in the fmod-project like this “spacechef/Assets/StreamingAssets/”

So right now it seems like I have to build locally first, so the files are generated, then commit these files to the repo to then have my cloud build have access to the new files.

It would be nice if I could just press build in Fmod Studio to have the files updated in Unity. I really don’t do that very often so I don’t see why it should be a problem.

Thank you!

These original posts are regarding a much older version of the Unity Integration, where the banks were handled a bit differently.

Now banks only get copied into the ‘StreamingAssets’ folder at build time, to reduce the number of copies and mixups with different platform banks.

“I would not recommend storing the built banks or the Studio project inside the Assets folder”.

That was meaning outside of the ‘StreamingAssets’ folder (which would have been clearer). Having the entire Studio project inside the Unity project is still not a good idea, but banks can be stored in an intermediate folder under ‘Assets’ if required (eg. “Assets/FMODBanks/Desktop”). Then you can point the integration to those built banks instead of the Studio project.

Thanks, I’m doing exactly that, and after disabling the script that kept on creating files that I didn’t want according to this link (FMODStudioSettings.asset keeps appearing in version control with no changes - #4 by aaron_rh) it now seems to work fine.