# Loading Banks from path

**URL:** <https://qa.fmod.com/t/loading-banks-from-path/22146>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [October 1, 2024, 9:52am UTC](https://qa.fmod.com/t/loading-banks-from-path/22146 "2024-10-01T09:52:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MightBMay](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@MightBMay](https://qa.fmod.com/u/MightBMay)\
**Post date:** [October 1, 2024, 9:52am UTC](https://qa.fmod.com/t/loading-banks-from-path/22146/1 "2024-10-01T09:52:05Z")

</div>

Hi,  
Am new to FMOD and am wondering if i’m not fully understanding the usage of Runtimemanager.LoadBank().

From my understanding, grouping events into banks is good to do, as you can load/unload unnecessary events.

I plan on having one bank per enemy in my game, so that if an enemy isn’t in a level, i don’t waste memory loading their sounds, however for the life of me i cannot get loading the banks to work properly.

Since i will have one bank per enemy ( and a generic “Enemy” bank for shared sounds) I want to store a string to the bank’s path in each subclass of my Enemy class, and then load it upon spawning an enemy.

Here is the code i am using just for testing at the moment:

```auto
 private void Update()
{
    if(Input.GetKeyDown(KeyCode.V)) LoadBank("Enemies/Metal/Scissor");
    if (Input.GetKeyDown(KeyCode.B)) StartCoroutine(RecheckBank());
}

public void LoadBank(string path)
{
    RuntimeManager.LoadBank(path, true);
    RuntimeManager.StudioSystem.getBank(path, out var bank));

}

```

For testing, i am manually loading the bank when i press the button V in update(). i also have a coroutine that prints out all the loaded banks, so i can see when it is loaded.

When i Debug log the FMOD.RESULT from getBank, it is returning: ERR\_EVENT\_NOTFOUND  
but the bank is properly being loaded the first time.

I deload specific banks upon reloading my scene in my game.  
when i deload a bank and then try to reload it again using LoadBank(), it isn’t loading the 2nd time, even though i am calling it with a fixed path.

```auto
public void OnSceneReload()
    {

        // Get the list of loaded banks
        RuntimeManager.StudioSystem.getBankList(out FMOD.Studio.Bank[] loadedBanks);
        // Iterate banks and unload non ignored bank paths.
        for (int i = 0; i < loadedBanks.Length; i++)
        {
            FMOD.Studio.Bank bank = loadedBanks[i];
            bank.getPath(out string path);
            if (bank.isValid() && ! ignoreBankUnload.Contains(path))
            {
                bank.unload();
                Console.Log($"Unloading bank: {path}");
            }
        }
    }

```

This just gets the list of all loaded banks, and then unloads them if their path isn’t in a hashset (so i can keep some permanently loaded). Currently i have the hashset set up so it is ONLY deloading the “Enemies/Metal/Scissor” bank.

I have checked if it is loaded using the previously mentioned coroutine:

```auto
 IEnumerator RecheckBank()
 {
     yield return null;
     RuntimeManager.StudioSystem.getBankList(out var temp);
     foreach (var b in temp)
     {
         b.getPath(out string path);
         Debug.Log(path);
     }
 }

```

When i first load the scene, the bank “Enemies/Metal/Scissor” isn’t loaded, as intended. i have my fmod settings only load specific banks on initialization.  
When i press B to run the check for loaded banks, it reflects this appropriately.

When i then press V to load the bank, and B to check loaded banks it properly loads the bank, and appears in the list of loaded banks.

When i then deload the bank and press V again, which should load the same bank with the exact same path, nothing happens.

I have tried checking the RESULT’s returned from the various fmod methods, but they all either give the result ERR\_EVENT\_NOTFOUND, or similar things which shouldn’t be the case as it works perfectly fine the first time i am loading them.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [October 9, 2024, 1:06am UTC](https://qa.fmod.com/t/loading-banks-from-path/22146/2 "2024-10-09T01:06:48Z")

</div>

There’s a couple of potential causes of the behavior you’re describing.

The first would be that the path being used is incorrect, which seems like a possibility given that `"Enemies/Metal/Scissor"` would work for the initial `RuntimeManager.LoadBank()` call since it’s loading from the asset directory, but wouldn’t for `RuntimeManager.StudioSystem.getBank()` since the expected path format for banks starts with `"bank:/"`.

The second would be that the [strings bank](https://www.fmod.com/docs/2.02/api/glossary.html#studio-strings-bank) isn’t being loaded - you can read over the Advanced Topics chapter’s [GUIDs and Paths](https://www.fmod.com/docs/2.02/studio/advanced-topics.html#guids-and-paths) section in the FMOD Studio doc for more information. All path-based lookup functionality is dependent on the strings bank being loaded, and API functions will return `ERR_EVENT_NOTFOUND` if it isn’t loaded, so I’d recommend verifying that it is in fact loaded you’re calling any path-based functions.
