# 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:** 4

<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 26, 2022, 4:20am UTC](https://qa.fmod.com/t/can-not-load-bank-bytes-in-resources-files/19014/4 "2022-07-26T04:20:09Z")

</div>

My apologies I missed that, to use `Addressables` follow this example:

1. We need to ensure we have defined `UNITY_ADDRESSABLES_EXIST` in the player settings. This can be found under Unity Toolbar → Edit → Project Settings → Player → Other Settings → Script Compilation. You may get some errors in the console but that is fine, they will be solved in the next step.  

2. Import the `Addressable Package` from the Unity `Asset Manager Window` under Unity Toolbar → Window → Package Manager → Unity Registry → Addressables.

> **Package Manager**
>
> ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/0/089e2932de7011d78de1ad088947382890c35759.png)

1. Assign the FMOD `Text Assets` to `Addressables`, you can do this by selecting them in your `Project Directoy` and ticking the `Addressable` tick box  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/7/74b763458d65a39db1fd502208c167dd747ce836.png)
2. The `Addressables` will want to be loaded into memory `Asyn
3. Now the `Addressables` are ready to be loaded into memory. Create a new script named `LoadAllBanks` and then copy the following example into that script. You can change the name if you like.

> **LoadAllBanks class**
>
> ```auto
> Using UnityEngine; 
> using System;
> using System.Collections.Generic;
> using UnityEngine.AddressableAssets;
> using System.Collections;
> using UnityEngine.SceneManagement;
> 	
> public class LoadAllBanks : MonoBehaviour
> {
> public List<AssetReference> Banks = new List<AssetReference>();
> public string Scene;
> 	
> private static int numberOfCompletedCallbacks;
> 	
> void Awake()
> {
> StartCoroutine(LoadBanksAsync());
> }
> 	
> private Action Callback = () =>
> {
> numberOfCompletedCallbacks++;
> };
> 	
> IEnumerator LoadBanksAsync()
> {
> 	
> Banks.ForEach(b => FMODUnity.RuntimeManager.LoadBank(b, true, Callback));
> 	
> while (numberOfCompletedCallbacks < Banks.Count)
> yield return null;
> 	
> while (FMODUnity.RuntimeManager.AnySampleDataLoading())
> yield return null;
> 	
> AsyncOperation async = SceneManager.LoadSceneAsync(Scene);
> 	
> while (!async.isDone)
> {
> yield return null;
> }
> 	
> Banks.ForEach(b => b.ReleaseAsset());
> }
> }
> 
> ```

1. In the Inspector window of an object with your script, add the `banks` you wish to load  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/0/06865e404f05de30d02f559297bca128b4d790da.png)

2. Loading Unity assets are an Asynchronous operation, further explanation can be found in [Unity | Getting started with Addressable Assets](https://docs.unity3d.com/Packages/com.unity.addressables@0.4/manual/AddressableAssetsGettingStarted.html), so we will need an empty `scene` to load the `banks` then a populated `scene` to play them in. So in your Unity `Build Settings` you will want to have something like this:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/d/d3b59b6613735d5847b48ee3073009992548dba9.png)  
In the `EmptyScene` is our object that loads our `banks`, then we transition to the `MusicScene` where we will hear our events.

3. Make sure to start the project in the `EmptyScenetoLoadBanks`, now all the assigned `banks` should be loaded

Sorry about the confusion, I hope this helps!

---

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