# Unity iOS Events from banks not found

**URL:** <https://qa.fmod.com/t/unity-ios-events-from-banks-not-found/14883>\
**Category:** Unity\
**Created:** [July 24, 2019, 3:33pm UTC](https://qa.fmod.com/t/unity-ios-events-from-banks-not-found/14883 "2019-07-24T15:33:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nefulum](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nefulum](https://qa.fmod.com/u/Nefulum)\
**Post date:** [July 24, 2019, 3:33pm UTC](https://qa.fmod.com/t/unity-ios-events-from-banks-not-found/14883/1 "2019-07-24T15:33:50Z")

</div>

Hey all,

We are building an iOS app using Unity with FMOD integration. Currently, we are able to load all banks into the project both in the Unity Editor and the iOS device. However, once these banks are loaded, they seem to have no events associated with them. The odd thing is that within the Unity Editor, everything works as expected. The banks load, and we are able to loop through the events within those banks to create buttons for the user to interact with, even play. However, once we build to an iOS device, when we call getEventList on the bank we receive the RESULT error FMOD\_ERR\_INVALID\_HANDLE.

Within the Unity Editor our FMOD Settings are set to Initialization: Load Banks = None

Here is our Code Snippet:  
IEnumerator Start()  
{  
FMOD.Studio.Bank masterbank;  
FMOD.Studio.Bank masterbankstrings;  
RuntimeManager.StudioSystem.loadBankFile(“Assets/StreamingAssets/Master.bank”, FMOD.Studio.LOAD\_BANK\_FLAGS.NORMAL, out masterbank);  
RuntimeManager.StudioSystem.loadBankFile(“Assets/StreamingAssets/Master.strings.bank”, FMOD.Studio.LOAD\_BANK\_FLAGS.NORMAL, out masterbankstrings);  
Banks = Settings.Instance.Banks;  
\_Dropdown.ClearOptions();  
\_Dropdown.AddOptions(Banks);

```
    bankArray = new FMOD.Studio.Bank[Banks.Count];
    int counter = 0;

    foreach (string bank in Banks)
    {
        RuntimeManager.StudioSystem.loadBankFile("Assets/StreamingAssets/" + Banks[counter] + ".bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out bankArray[counter]);
        categories.Add(bank, new List<CategoryItem>());
        counter++;
    }

    while (RuntimeManager.AnyBankLoading())
    {
        yield return null;
    }

    for(int ii = 0; ii < bankArray.Length; ii++)
    {

        FMOD.Studio.EventDescription[] eventList;

        RESULT result = bankArray[ii].getEventList(out eventList);
        if (result != RESULT.OK)
        {
            print(result.ToString());
            yield break;
        }

        while(eventList.Length == 0)
        {
            print("Always yeilding");
            yield return null;
        }
        
        for(int jj = 0; jj < eventList.Length; jj++)
        {
            CategoryItem item = new CategoryItem();
            FMOD.RESULT r = eventList[jj].createInstance(out item.eventInstance);
            if(r == FMOD.RESULT.OK)
            {
                RESULT FUFMOD = item.eventInstance.getDescription(out item.description);
                if (FUFMOD == RESULT.OK)
                {
                    print("DESC OK");
                }
                int length;
                RESULT lengthR = item.description.getLength(out length);
                if (lengthR == RESULT.OK)
                {
                    print("Lengt OK");
                    item.lengthOfClip = (float)length / 1000f;
                }
                
                RESULT re = item.description.getPath(out item.eventPath);
                if(re == RESULT.OK)
                {
                    print("NAME OK: " + item.eventPath);
                    int i = item.eventPath.LastIndexOf('/');
                    item.name = item.eventPath.Substring(i + 1, item.eventPath.Length - 1 - i);
                    print(item.name + " | " + item.lengthOfClip);
                } else
                {
                    print(re.ToString());
                }
                //if(item.name != null && item.name != "")
                //{
                // print(item.name);
                // categories[Banks[ii]].Add(item);
                // //checker = categories[Banks[ii]].ToArray();
                //} else
                //{
                // print("name is null");
                //}
                categories[Banks[ii]].Add(item);
            } else
            {
                print("Events Not Loaded");
                print(r.ToString());
            }
        }
    }
    OnCategoryChosen();
}

```

Any help on why these events may not load on iOS where they do load in the Editor would be VERY much appreciated. Also, I’m more than willing to provide any additional information.

---

<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:** [July 30, 2019, 6:50am UTC](https://qa.fmod.com/t/unity-ios-events-from-banks-not-found/14883/2 "2019-07-30T06:50:16Z")

</div>

The issue will be the bank path in the loadBankFile, when referring to the StreamingAssets folder across multiple platforms it is best to use [`Application.streamingAssetsPath`](https://docs.unity3d.com/ScriptReference/Application-streamingAssetsPath.html). This provides the platform specific path.

---

<div class="post-metadata">

**Author:** ![Nefulum](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nefulum](https://qa.fmod.com/u/Nefulum)\
**Post date:** [August 1, 2019, 4:15pm UTC](https://qa.fmod.com/t/unity-ios-events-from-banks-not-found/14883/3 "2019-08-01T16:15:21Z")

</div>

Hey Cameron,

Thanks for getting back to me. That tracks with what I’ve done currently in my project, which is to just rip out FMOD and use the files directly in the streamingAssets folder. Obviously, we’d like to use FMOD. I think you’re telling me this line of code:

RuntimeManager.StudioSystem.loadBankFile(“Assets/StreamingAssets/” + Banks[counter] + “.bank”, FMOD.Studio.LOAD\_BANK\_FLAGS.NORMAL, out bankArray[counter]);

needs to be changed to:  
RuntimeManager.StudioSystem.loadBankFile(“file:///” + Application.streamingAssetsPath + Banks[counter] + “.bank”, FMOD.Studio.LOAD\_BANK\_FLAGS.NORMAL, out bankArray[counter]);

That track with what you’re saying?

Thanks,  
~N

---

<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:** [August 2, 2019, 4:09am UTC](https://qa.fmod.com/t/unity-ios-events-from-banks-not-found/14883/4 "2019-08-02T04:09:30Z")

</div>

For iOS, we will just use:

```auto
Application.streamingAssetsPath + '/' + bankName.bank

```

You can see what we do for different platforms in `RuntimeUtils.GetBankPath`.
