# Addressables: Load Banks and play event on the same frame

**URL:** <https://qa.fmod.com/t/addressables-load-banks-and-play-event-on-the-same-frame/21041>\
**Category:** Unity\
**Created:** [December 28, 2023, 3:04pm UTC](https://qa.fmod.com/t/addressables-load-banks-and-play-event-on-the-same-frame/21041 "2023-12-28T15:04:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gatalskii](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@gatalskii](https://qa.fmod.com/u/gatalskii)\
**Post date:** [December 28, 2023, 3:04pm UTC](https://qa.fmod.com/t/addressables-load-banks-and-play-event-on-the-same-frame/21041/1 "2023-12-28T15:04:07Z")

</div>

Hello, forum!

I’m using FMOD plugin with Asset Bundle import type.

I’ve implemented some manager, which loads banks in Awake as was described in [https://www.fmod.com/docs/2.00/unity/examples-async-loading.htm](https://www.fmod.com/docs/2.00/unity/examples-async-loading.htm). I added StudioEventEmitter to the scene with particular sound event.  
Both manager and emitter objects are located on the same scene. Manager object has Script execution order below than `StudioEventEmitter` to be sure that loading completes before event will start to play.

Figured out that event doesn’t fire causing error (`EventNotFoundException`). That was fixed only after putting delay something like this in the derived class by `StudioEventEmitter` :

```auto
protected override void Start()
{
	StartCoroutine(DelayedStart());
}

private IEnumerator DelayedStart()
{
	yield return new WaitForEndOfFrame();
	base.Start();
}

```

So, my question is how to fire events in the normal way without these delay stuff? As I understood between loading and playing occurs some initialization stuff on FMOD Studio’s side. Could you please specify how to force that kind initialization?  
Thanks in advance!

---

<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:** [January 2, 2024, 12:05am UTC](https://qa.fmod.com/t/addressables-load-banks-and-play-event-on-the-same-frame/21041/2 "2024-01-02T00:05:21Z")

</div>

Hi,

What version of the FMOD integration are you using?

Loading the banks is not an instant operation. An option may be to utilize a loading scene outlined here: [Unity Integration | Scripting Examples: Asynchronous Loading](https://fmod.com/docs/2.02/unity/examples-async-loading.html).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![gatalskii](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@gatalskii](https://qa.fmod.com/u/gatalskii)\
**Post date:** [January 2, 2024, 10:02am UTC](https://qa.fmod.com/t/addressables-load-banks-and-play-event-on-the-same-frame/21041/3 "2024-01-02T10:02:58Z")

</div>

Hi, Connor!

Thanks for you answer! I’m using 2.02 version of Unity integration.

You’ve answered correctly that loading is not an instant operation. I saw your provided example of asynchronous loading but my case a little straightforward:

[ExecutionOrder(-221)] (customly set in player settings)  
`BankLoader.cs`:

```auto
#if UNITY_EDITOR
private void Awake()
{
	LoadAllBanks();
}
#endif

private void LoadAllBanks()
{
    FMODUnity.RuntimeManager.LoadBank(masterBank);
    FMODUnity.RuntimeManager.LoadBank(masterStringBank);

    foreach (AssetReference bankReference in banksToPreload)
    {
        FMODUnity.RuntimeManager.LoadBank(bankReference, true);
    }
}

```

After completing execution of `LoadAllBanks()` I expected using `StudioEventEmitter`’s “On Object Start” event right after load was completed because load by itself was performed synchronously.  
So, `StudioEventEmitter` is able to work normally if I make inherited class and calling event “On Object Start” (see `base.Start()`) only after any script execution was completed:

[ExecutionOrder(-220)] (set by plugin)  
`CustomStudioEventEmitter.cs`:

```auto
protected override void Start()
{
	StartCoroutine(DelayedStart());
}

private IEnumerator DelayedStart()
{
	yield return new WaitForEndOfFrame();
	base.Start();
}

```

---

<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:** [January 5, 2024, 3:35am UTC](https://qa.fmod.com/t/addressables-load-banks-and-play-event-on-the-same-frame/21041/4 "2024-01-05T03:35:08Z")

</div>

Hi,

Thank you for the code,

I think the current solution is your best option. As for the execution order that seems like a Unity issue. Apologies I cannot assist further.
