# Load Banks from PersistentDataPath on mobile

**URL:** <https://qa.fmod.com/t/load-banks-from-persistentdatapath-on-mobile/17008>\
**Category:** Unity\
**Created:** [April 9, 2021, 2:07am UTC](https://qa.fmod.com/t/load-banks-from-persistentdatapath-on-mobile/17008 "2021-04-09T02:07:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dafar](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dafar](https://qa.fmod.com/u/dafar)\
**Post date:** [April 9, 2021, 2:07am UTC](https://qa.fmod.com/t/load-banks-from-persistentdatapath-on-mobile/17008/1 "2021-04-09T02:07:47Z")

</div>

Hi,

I’m trying to load a bank from my server, but can’t make it to work on mobile, only desktop.

The original path for Master.bank and Master.Strings.bank is Assets/StreamingAssets/.

I setup integration as Single Platform Build - Import Type: Streaming Assets.

I tried Asset Bundle, but the path will never be the correct one.

When I add Application.persistentDataPath to the bank path, the full real path becomes Assets/StreamingAssets/ + Application.persistentDataPath.

So I’m never able to load from persistentDataPath.  
Is there a workaround or something I’m missing?

Here’s the code:

```
UnityWebRequest MyRequest;
IEnumerator DownloadMusic01()
{
    MyRequest = new UnityWebRequest("https://myserver.com/music1.bank", UnityWebRequest.kHttpVerbGET);

path = Path.Combine(System.IO.Path.Combine(Application.streamingAssetsPath), "music1.bank");
MyRequest.downloadHandler = new DownloadHandlerFile(path);
yield return MyRequest.SendWebRequest();

if (MyRequest.isHttpError)
    Debug.LogError(MyRequest.error);
else
    Debug.Log("File successfully downloaded and saved to " + path);

if (MyRequest.downloadHandler.isDone)
{
    bankPathMusic1 = path;

    FMOD.Studio.System bankload;
    FMOD.Studio.System.create(out bankload);
    var loadingResult = bankload.loadBankFile("music1.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank);

    loadedBank.loadSampleData();

    bankPathMusic1 = "music1.bank";

    FMODUnity.RuntimeManager.LoadBank(bankPathMusic1, true);

    PlayerStateEvent = "event:/Mix1";
    playerState = FMODUnity.RuntimeManager.CreateInstance(PlayerStateEvent);
    playerState.start();
    
}

```

}

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [April 12, 2021, 4:46am UTC](https://qa.fmod.com/t/load-banks-from-persistentdatapath-on-mobile/17008/2 "2021-04-12T04:46:30Z")

</div>

It appears that you are trying to load the same bank twice, using `FMOD.Studio.System.loadBankFile` and `FMODUnity.RuntimeManager.LoadBank`, but you should only need to load it once. Also, `FMOD.Studio.System.create` creates a brand new system outside of the one used by the RuntimeManager.

You can access the RuntimeManagers system by doing something like this:

```auto
FMOD.Studio.System studioSystem;
studioSystem = FMODUnity.RuntimeManager.StudioSystem;
var loadingResult = studioSystem.loadBankFile("music1.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank);

```

If the bank is located in the streamingAssets folder then you should just be able to pass in the bank name to `RuntimeManager.LoadBank` but if it is in a different directory, that FMOD doesn’t know about, you will have to load it manually using `FMOD.Studio.System.loadBankFile`.

Using addressables, you have the option of loading the asset yourself or passing it to the RuntimeManager and having it load the asset before loading the bank, see [FMOD - User Guide (assetbundles addressables)](https://fmod.com/resources/documentation-unity?version=2.1&page=user-guide.html#assetbundles-addressables).

---

<div class="post-metadata">

**Author:** ![dafar](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dafar](https://qa.fmod.com/u/dafar)\
**Post date:** [April 12, 2021, 3:44pm UTC](https://qa.fmod.com/t/load-banks-from-persistentdatapath-on-mobile/17008/3 "2021-04-12T15:44:45Z")

</div>

Thanks, Cameron!!

Now it’s working on both Desktop and Android.  
Couldn’t test in IPhone because of a build error inside XCode that is supposed to be fixed soon.

Thanks a ton for your help!!
