# How to obtain bankName from EventReference GUID？

**URL:** <https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976>\
**Category:** Unity\
**Tags:** unity\
**Created:** [July 5, 2022, 8:10am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976 "2022-07-05T08:10:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![lxx](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@lxx](https://qa.fmod.com/u/lxx)\
**Post date:** [July 5, 2022, 8:10am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/1 "2022-07-05T08:10:45Z")

</div>

my project update to the Version 2.02.  
I notice that EventRef is obsolete.So I used EventReference.  
What I’m thinking about right now is using assetBundle. But I can’t get the bankname through EventReference. So I can’t load the corresponding assetBundle.  
Please tell me how to get bankame via EventReference GUID. Thank you very much.

---

<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 7, 2022, 3:35am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/2 "2022-07-07T03:35:37Z")

</div>

Hi,

Unfortunately, there isn’t a way to retrieve a `bank` name directly from an `EventReference`. However, you could implement a `Dictionary` containing all the `banks` and their `events` yourself.

You will want to use [Studio::System:getBankList](https://fmod.com/docs/2.02/api/studio-api-system.html#studio_system_getbanklist), which you supply with an array of `FMOD.Sudio.Bank`s, calling this on the currently initialized Studio System. Whether that is one you have initialized or if it is the `FMOD.RunTimemanager.StudioSystem`.

Once you have the array of `banks` you will want to loop through the array retrieving all the events attached to each `bank` using [Studio::System::getEvetList](https://fmod.com/docs/2.02/api/studio-api-bank.html#studio_bank_geteventlist). Supplying an array of `FMOD.Studio.EventDescriptions` this time.

Now loop through the `EventDescription` array adding each event and bank to the Dictionary, using the `event` as the ‘key’ as the `bank` ‘value’.

Now you will have a Dictionary full of the `banks` and you can use the `events` in that Dictionary for their corresponding `bank`. You can decide how you want to implement accessing this Dictionary throughout your code.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![lxx](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@lxx](https://qa.fmod.com/u/lxx)\
**Post date:** [July 7, 2022, 8:43am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/3 "2022-07-07T08:43:58Z")

</div>

Hi Connor, thanks for the response.

I have tried this method. But not the desired effect.[Studio::System:getBankList](https://fmod.com/docs/2.02/api/studio-api-system.html#studio_system_getbanklist) would get only `Banks` has been loaded. `Banks` that have not been loaded do not exist in this list.

Before creating `EventInstance`, you first load the Bank.

However, I am currently unable to load the bank from the `Serializable` `EventReference`, Because I can’t get the `BankName` from `EventReference`.

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

Above is my code, but it cannot play at present because bank cannot load.I’m now thinking of moving `EventReference.Path` out of `EventReference``UNITY_EDITOR Define`.This way I can get `BankName` by `EventReference.Path` and load `Bank`. FMOD also works fine.

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

I still hope there is a better solution. Because I saw the official guide creator to use `FMOD.GUID`.

---

<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 8, 2022, 12:42am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/4 "2022-07-08T00:42:01Z")

</div>

Hi,

Sorry to hear that didn’t help

Could you please link to which official guide you are using?

There is an easier way to play from an `EventReference` that doesn’t require a reference to the `events bank`. It is explained in Unity Integration [Scripting Examples | Basic](https://fmod.com/docs/2.02/unity/examples-basic.html).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![lxx](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@lxx](https://qa.fmod.com/u/lxx)\
**Post date:** [July 8, 2022, 7:18am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/5 "2022-07-08T07:18:41Z")

</div>

Hi Connor,

Here is the documentation I looked at. [FMOD for Unity](https://fmod.com/docs/2.02/unity/welcome.html)

I also want to use this method to create an `EventInstance` directly to play the audio file. But the audio data is in the `Bank`. I have to load the `Bank` first. If I create directly I get a `NullReferenceException`.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/5/56ec8ceafce098205358e329ccb8af1bf19880a9.png)

The `Import Type` I’m currently using is `AssetBundle`. Below is my `AssetBundle`.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/7/7c7a2f7fd252c9a8dd063a6ca7734687a5266d76.png)

Before calling `FMODUnity.RuntimeManager.CreateInstance(EventReference)`, I have to get the `BankName`, load the `AssetBundle` file, then load the `Bank`, and finally I can `CreateInstance`.

The current problem is that I can’t get the corresponding `BankName` through the `EventReference` on the script, so I can’t load the `Bank`.

The current problem is that the corresponding `BankName` cannot be obtained through the `EventReference` on the script, so the corresponding `AssetBundle` cannot be loaded. After loading the `AssetBundle`, I need to load the `Bank`.

thanks again for your response.

---

<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 11, 2022, 5:50am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/6 "2022-07-11T05:50:18Z")

</div>

Hi,

The import type will change a lot of functionality. When working with the `Asset Bundle`  
A solution may be getting the `bank` names through an Editor Window using the FMODUnity.BankRef which will allow you to choose the `bank` you wish to load from a list.

Keep in mind that the `Master.bank` and `Master.strings.bank` must be loaded for Events to be triggered properly. Without the `Master.bank` you will not be able to call events at all, and without the `Master.strings.bank` you will not be able to retrieve `events` using their paths.

Firstly the easiest way to get a list of the currently loadable `banks` is using:

```auto
[FMODUnity.BankRef] public string _bank;

```

Although to allow you to load multiple banks which will be required it is a good idea to create a list instead like this:

```auto
[FMODUnity.BankRef] public List<string> _banksToBeLoaded = new List<string>();

```

This will allow you to select multiple `banks` to be loaded in Editor like this:

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

Then you can loop through the list loading each bank like this:

```auto
for (int i = 0; i < _banksToBeLoaded.Count; i++)
{
         FMODUnity.RuntimeManager.LoadBank(_banksToBeLoaded[i]); 
}

```

Allowing all the `banks` in the list to be loaded!

This way you wont need to get the name of the `bank` off the `EventReference`

Hope this helps!

---

<div class="post-metadata">

**Author:** ![lxx](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@lxx](https://qa.fmod.com/u/lxx)\
**Post date:** [July 11, 2022, 8:54am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/7 "2022-07-11T08:54:39Z")

</div>

Hi Connor,

This solution can’t solve my problem, I want to load the `bank` only when I need it.

For example, I only load the `Music1 Bank` in the first interface of the game, and I only load the `Music2 Bank` in the second game. it’s so flexible. But this idea is currently impossible. I thought of the solution.

1. I can only achieve this effect by saving the associated data of `Event` and `Bank` by myself.

```auto
[SerializeField]
public List<FMOD.GUID> _eventGuids = new List<FMOD.GUID>();
[SerializeField]
public List<string> _bankNames = new List<string>();

//key : eventGuid | value : bankName
private Dictionary<FMOD.GUID, string> _eventToBankName = new Dictionary<FMOD.GUID, string>();

private void Awake()
{
       for (int i = 0; i < _eventGuids.Count; i++)
       {
 	       _eventToBankName.Add(_eventGuids[i], _bankNames[i]);
       }
	_eventGuids.Clear();
	_bankNames.Clear();
	_eventGuids = null;
 	_bankNames = null;
}

```

1. Move `Path` out of `UNITY_EDITOR Define`.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/1/193756145b18fbef358734a7eef174747b1ecf8c.png)

I am currently using the second solution. I still want more flexibility and compliance. Looking forward to better solutions

Thank you for your help.

---

<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 13, 2022, 1:43am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/8 "2022-07-13T01:43:05Z")

</div>

Hi,

Just to clarify, you are using the `AssetBundle` import method so that you only load `banks` in when you require them. You want to be able to find the name of a `bank` from an `event` so it can be loaded when desired, without having to reference it from the Unity Editor Window?

Hoping to avoid any other confusion.

Within the Unity integration `banks` and `events` have a one-way relationship. `banks` know all the `events` that they encapsulate which can be read once they are loaded into memory. `events` do not know which `bank` they belong too, as they are not normally used to load in `banks`. You are asking the `event` for information it does not know.

The `event path` you show is not a reference to the `bank` it is encapsulated by but rather the `events` location in the FMOD Studio project, this is explained under GUIDS and Paths.

I apologize for any confusion.

---

<div class="post-metadata">

**Author:** ![lxx](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@lxx](https://qa.fmod.com/u/lxx)\
**Post date:** [July 13, 2022, 4:10am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/9 "2022-07-13T04:10:28Z")

</div>

Hi Connor,

Thanks again for the explanation, it deepened my understanding of the `FMOD System`.

Yes, the bank knows all the `events` it encapsulates, but the events have no way of knowing which `bank` they are.

But my current thinking is that the `bank` is only loaded when I need it, so I have to know which `bank` the `event` belongs to. I’m sorry this deviates from FMOD’s design, but this is the functionality I need at the moment.

In the 2.00.08 version I used before, because I used `Path` as the playback credentials, I could easily get the `bank` corresponding to the `event`, but in the latest version, I can only make some changes, as I replied above , because using `FMOD.GUID` does not satisfy my current thinking.

My only thought at the moment is that in the near future, FMOD uses a single `FMOD.GUID` credential to eliminate the use of `Path`, so it will be very inconvenient to implement my idea.

Thanks again for your reply and help, hope there is a better solution.

---

<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 15, 2022, 4:36am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/10 "2022-07-15T04:36:33Z")

</div>

Hi,

Thank you for clarifying I think we are on the same page now.  
Looking over things I believe the best situation for you right now is your `Dictionary` that you have set up.  
Currently, we are not looking at implementing the functionality you want. But, I will pass it on to the Dev team to investigate.

I apologize I couldn’t help further

---

<div class="post-metadata">

**Author:** ![lxx](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@lxx](https://qa.fmod.com/u/lxx)\
**Post date:** [July 20, 2022, 4:40am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/11 "2022-07-20T04:40:16Z")

</div>

Hi Connor,

Thanks for your continued reply and pass on to the development team.

I’ll keep watching and hope for better news in the future.

I wish FMOD better and better.

---

<div class="post-metadata">

**Author:** ![touringmaze](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@touringmaze](https://qa.fmod.com/u/touringmaze)\
**Post date:** [February 8, 2023, 4:49am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/12 "2023-02-08T04:49:59Z")

</div>

Hi guys, I am having trouble doing my UI menu sounds with a button click because of this EventRef is obsolete. how can I have click sounds and hover sounds on my menu with FMOD?

---

<div class="post-metadata">

**Author:** ![touringmaze](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@touringmaze](https://qa.fmod.com/u/touringmaze)\
**Post date:** [February 8, 2023, 5:00am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/13 "2023-02-08T05:00:37Z")

</div>

Hi Connor, I am having trouble doing my UI menu sounds with a button click because of this EventRef is obsolete. how can I have click sounds and hover sounds on my menu with FMOD? thank you!!!

---

<div class="post-metadata">

**Author:** ![touringmaze](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@touringmaze](https://qa.fmod.com/u/touringmaze)\
**Post date:** [February 8, 2023, 5:02am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/14 "2023-02-08T05:02:28Z")

</div>

May I see your full script, trying to make a UI menu with FMOD click and hover sound

---

<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:** [February 8, 2023, 5:18am UTC](https://qa.fmod.com/t/how-to-obtain-bankname-from-eventreference-guid/18976/15 "2023-02-08T05:18:48Z")

</div>

Hi,

What version of FMOD and Unity are you using?
