# Can not load bank(.bytes) In Resources Files

**URL:** https://qa.fmod.com/t/can-not-load-bank-bytes-in-resources-files/19014
**Category:** Unity
**Tags:** unity
**Created:** [July 18, 2022, 10:50am UTC](https://qa.fmod.com/t/can-not-load-bank-bytes-in-resources-files/19014 "2022-07-18T10:50:37Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)
#### Post date: [July 22, 2022, 3:21am UTC](https://qa.fmod.com/t/can-not-load-bank-bytes-in-resources-files/19014/2 "2022-07-22T03:21:04Z")

</div>

Hi,

Thank you for taking those screenshots, they helped a lot!

You are missing one crucial step in getting this to work. A deeper explanation of each step can be found in the Unity Docs under [Unity Integration | AssetBundles & Addressables.](https://fmod.com/docs/2.02/unity/user-guide.html#assetbundles-addressables)

First, select all your build FMOD `text assets` and assign them to a new `AssetBundle`. You can have as many differently named `AssetBundles` as you need to load in different `banks` when they are required.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/e87557d3c20331003b4d69a45718a77cf2c19cc8.png)

Keep in mind the `name` you use, as it is required for the next step.

Once all your FMOD `text assets` have been assigned to an `AssetBundle`, even ones that will be loaded in later, then we need to build them using the example from the Docs:

> **BuildAssetBundles class**
>
> ```auto
> using FMODUnity;
> using UnityEditor;
> using UnityEngine;
> // This #if statement will stop the function being compiled in build as we are using Editor only function calls
> #if UNITY_EDITOR
> 
> public class BuildAssetBundles
> {
> [MenuItem("Tools/Build Asset Bundles")]
> public static void StartProcess()
> {
> BuildTarget buildTarget = BuildTarget.StandaloneWindows64;
> 
> EventManager.CopyToStreamingAssets(buildTarget);
> // The function's first parameter will be the file path where you want your AssetBundles to be built. In your case: Application.dataPath + "//Resources//Sound". However, it is a good idea to leave these in the `StreamingAsset` folder 
> BuildPipeline.BuildAssetBundles(Application.dataPath + "//Resources//Sound", BuildAssetBundleOptions.None, buildTarget);
> 
> EventManager.UpdateBankStubAssets(buildTarget);
> }
> };
> #endif
> 
> ```

This script will give us a new option on the Unity toolbar under `Tools`  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/3/3d246e7bba1c67173d9d27ef97841f864a58c097.png)

When you click this option it should build all your FMOD `text assets` into Unity `AssetBunldes` in the destination folder. The destination folder will have to exist before the function is called.

Now we will need to load those `AssetBundles` like this:

> **LoadAllBanks class**
>
> ```auto
> using System.IO;
> using UnityEngine;
> 
> public class LoadAllBanks : MonoBehaviour
> {
> void Awake()
> {
> // This will need to be the same file path as where you are building the AssetBundles too.
> var assetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.dataPath + "/Resource/Sound", "banks"));
> if (assetBundle == null)
> {
> Debug.LogError("Failed to load AssetBundle!");
> return;
> }
> 
> foreach (var name in assetBundle.GetAllAssetNames())
> {
> FMODUnity.RuntimeManager.LoadBank(assetBundle.LoadAsset<TextAsset>(name));
> }
> FMODUnity.RuntimeManager.StudioSystem.getBankCount(out int count);
> 
>         
> assetBundle.Unload(false);
> }
> }
> 
> ```

Now your `banks` should hopefully be loaded. Keep in mind that not all banks need to loaded in simultaneously. However, the `Master.bytes` and the `Master.strings.bytes` will need to be loaded first.

Hope this helps!

---

_[View the full topic](https://qa.fmod.com/t/can-not-load-bank-bytes-in-resources-files/19014)._
