Our project is trying to utilize different speaker set ups (Stereo, 5.1, 7.1) and I wanted to know the right way to approach swapping between the banks appropriately depending on the needed speaker mode.
The current idea is to utilize a Multiple Platform Build directed at the folder that houses three FMOD builds for our three targeted speaker types. I am trying to use RuntimeManager.LoadBank(“bankName”, true); to load the appropriate bank, but I this is where I think I’m misunderstanding the intended approach in achieving what we are trying to do, what I need is a way to in-code switch which of the multi-platforms to swap to.
Right now for the bank names I have a [FMODUnity.BankRef] public string BankName; to grab the name of the loaded banks and it’s only option is the projects Master bank, so that is not giving me a bank for the different speaker-targeted builds.
Any guidance in the best way to approach this would be appreciated.
Does anyone have any experience with multi platform builds and switching them in run time?
Hi,
Apologies for the delayed response!
We have a detailed explanation here: Change output type in the game - #2 by Leah_FMOD
Please let me know if you have any issues with implementation.
So with this solution, we simply build out the game such that the meta files are separated from the other bank files and then load them via name using LoadBank/UnloadBank()but for an example like the one given, the name of each bank is just “Master” or Music/SFX (our project uses similar naming schemes). What exact should I be passing into the calls to differentiate one set of bank meta files vs. the others?
https://fmod.com/docs/2.02/studio/advanced-topics.html#separating-metadata-and-assets-in-built-banks
Our project was already built out with the meta files separated, and it’s split into 3 folders; Stereo, 7.1 and 5.1 in the attached example if you want to see how the bank names and meta files built out. We are using the[FMODUnity.BankRef]attribute to get the names of the banks in the project (the only ones that show up are Master and Master.strings). So it appears we are building the project out as suggested, but I am unclear on how the actual loading/unloading from one set of banks to the other will work via code.
(Bank/meta file set up for Stereo/7.1/5.1)
(Attempt to get bank names; the plan was to pass this value into a.LoadBanks(bankName); call)
Hi,
Would it be possible to upload your current loading implementation to your profile or me test have a look at?
Using
[System.Serializable]
public class CustomBanks
{
public FMOD.SPEAKERMODE mode;
[FMODUnity.BankRef]
public List<string> BankNames = new List<string>();
}
I am able to see all my loaded banks:
Could I also grab a screenshot of your FMOD Settings:
Note, that we will have to implement a system for copying over the different SPEAKERMODE banks to the build as that is not something the integration natively supports. But once the banks are in the build, loading them should be quite straight forward:
public void LoadBanks(FMOD.SPEAKERMODE mode)
{
if (!loaded)
{
for (int i = 0; i < customBanks.Length; i++)
{
if (customBanks[i].mode == mode)
{
string bankFilePath = "";
switch (mode)
{
case FMOD.SPEAKERMODE._7POINT1:
bankFilePath = "7.1";
break;
default:
bankFilePath = "Desktop";
break;
}
foreach (string bankName in customBanks[i].BankNames)
{
#if UNITY_EDITOR
FMODUnity.RuntimeManager.LoadBank(bankName);
#else
FMODUnity.RuntimeManager.LoadBank($"Build/{bankFilePath}/{bankName}");
#endif
loaded = true;
return;
}
}
}
}
}
Hope this helps!
Very strange, Master is still the only bank I can see when using [FMODUnity.BankRef]
And still don’t quite understand the given example. Say we have to load 5.1 ‘Master’ bank vs. a 7.1 ‘Master’ bank. We’re passing ‘Master’ to LoadBank() within the unity editor. I understand the #else clause that loads directly via path; I’m misunderstanding how the #if UNITY_EDITOR portion would work given that we are passing the same Bank name. Unless the idea is that the different platform folders would produce a different string when referenced with [FMODUnity.BankRef].
That said, I have updated my profile with a break down of the project set up as it relates to this issue and hopefully that can help in spotting where we went wrong. We are still not getting the correct bank names, so it seems like something went wrong with importing the project in the project settings/something wrong with our folder structure within StreamingAssets?