Hi, im trying to figure out how to load and unload banks via code and the documentation is a bit unclear for me.
I´m using the command LoadBank , which demands the bankName + boolean parameter. IE:
private Bank loadBank;
RuntimeManager.LoadBank(loadBank, true);
FMOD.RESULT result = RuntimeManager.StudioSystem.getBank(loadBank, out loadedBank);
It doesn´t work and I´m a bit clueless. So my questions are:
- When naming the banks to load should i use a string var or a bank var (for example public Bank loadBank).
- Should i add “.bank” to the name of the bank to load?.
- I cannot get the path of any bank (i use getPath).
- If i wanted to save the name of a loaded bank in a public variable , what sould i use?
 Sorry for this mess and thank you for your help 
 
            
              
              
              
            
            
           
          
            
            
              Hi,
We have a StudioBankLoader.cs script which may be a useful reference.
There are three options for variables to pass to LoadBank()
- string
- assetReference
- asset
I would suggest using a string with the FMODUnity.BankRef attribute:
[FMODUnity.BankRef]
public string loadBank;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
    FMODUnity.RuntimeManager.LoadBank(loadBank, true);
}
Unity Integration | Scripting API Reference - Banks.
Using the FMODUnity.BankRef will take care of this for you.
Could I get a code snippet where you are trying to retrieve the path?
Refer to answer above.
No worries! Please let me know if there is anything else I can assist with!
             
            
              
              
              1 Like
            
            
           
          
            
            
              Thank you for your fast reply. BankRef worked perfectly!!. Thank you very much.
Regarding the getPath method. This is the snippet.
            FMOD.RESULT result = RuntimeManager.StudioSystem.getBank(bankName, out bank);
            FMOD.RESULT path = bank.getPath(out bankPath);
Debug.Log("Path is " + bankPath");
             
            
              
              
              1 Like
            
            
           
          
            
            
              No worries, good to hear we got is solved!
Thank you for the code, that looks all good. Is it now working?
             
            
              
              
              1 Like
            
            
           
          
            
            
              Yes, it works!!. Thank you very much for the help!!
             
            
              
              
              1 Like