I am trying to dynamically load the required bank files at runtime.
But there is a problem, how do I know which bank file to load when I have a path of the event?
I noticed in the documentation that it mentions that in the master.string.bank folder, the paths to all events are stored :
FMOD - Getting Events into Your Game (what building creates)
But I have referred to the answers in this thread and did not succeed in getting any results, how can I solve this problem?
Retrieve list of events from Masters.strings bank - FMOD Studio - FMOD Forums
FMOD.RESULT result = FMOD.Studio.System.create(out system);
if (result != FMOD.RESULT.OK)
Debug.Log("Load system error!");
result = system.initialize(512, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, new IntPtr(0));
if (result != FMOD.RESULT.OK)
Debug.Log("Initialize system error!");
system.getBank("Master.strings", out Bank bank);
var r = bank.getStringCount(out int count);
//log: result:ERR_INVALID_HANDLE count:0
The master strings bank will need to be loaded before you call
Studio.System.getBank(). If you load your bank using one of the
loadBank functions that belongs to
Studio.System instead of by
FMODUnity.RuntimeManager.LoadBank(), you won’t need to call
loadBankFile() et al. will return a reference to the
If you do end up calling
Studio.System.getBank(), you need to preface your bank path with
"bank:/" in a similar convention to event path names - for example,
"bank:/Master.strings" would be the correct path in this case.
Hope that helps!
Thank you for your reply, I am now able to use the
getStringInfo() methods, but the content in the
master.strings.bank file doesn’t seem to be what I want.
Is there any way I can get what events are stored in each bank file? Or can I only read the entire bank file to get the full information?
You will need to load a bank to retrieve a list of events that belong to it - the following code snippet demonstrates doing so using
FMODUnity.RuntimeManager and printing all events contained in the bank:
FMODUnity.RuntimeManager.StudioSystem.getBank("bank:/SFX", out Bank sfxbank);
sfxbank.getEventList(out EventDescription events);
foreach (EventDescription e in events)
e.getPath(out string path);
However, it’s worth noting that the expected workflow with banks and events with FMOD is to know which events you will need ahead of time, and to sort them into bank accordingly so you know which bank(s)to load at a given moment. Is there a specific reason why you’re trying to dynamically load a bank with only knowledge of an event path?
I am using FMOD in Unity and by default FMOD loads all .bank files.
To save memory, I want to load only the necessary .bank files.
And I hope that the person setting the EventPath doesn’t need to be concerned about which .bank file the Event is actually stored in.
So I would like to accomplish a method like this:
public static void EmitEvent(string eventPath)
string bankName = FindBankNameByEventPath(eventPath);
var eventReference = RuntimeManager.PathToEventReference(eventPath);
var eventInstance = RuntimeManager.CreateInstance(eventReference);
var startResult = eventInstance.start();
The key point is how to implement the
But I found another way to accomplish the purpose, I can get the information in the Editor via
EventManager.Events and save them to a .json file. Read this .json file at runtime to find out where the event belongs in relation to the .bank file.
If you weren’t aware, banks consist of metadata (mixer and event structure, etc.) and sample data (your source audio). When loading a bank, unless you manually choose to load the sample data, only the metadata is loaded. Instead, when you create an Event Instance, FMOD will load the sample data on demand. As a result, it’s unlikely that you need to be concerned about banks taking up too much memory - I would recommend assigning your events to banks appropriately so you know which banks to load ahead of time for a given section of your Unity project.
For more information, I would recommend giving the following thread a read: Is it possible to load a Bank from an EventInstance or EventReference?
As well as taking a look at the Sample Data Loading section of the Studio API guide.
I didn’t realize that FMOD automatically loads the two parts separately, thanks for the important information!