# ParameterID as shared readonly/constant value

**URL:** <https://qa.fmod.com/t/parameterid-as-shared-readonly-constant-value/22197>\
**Category:** Unity\
**Created:** [October 18, 2024, 5:00pm UTC](https://qa.fmod.com/t/parameterid-as-shared-readonly-constant-value/22197 "2024-10-18T17:00:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lekret](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@Lekret](https://qa.fmod.com/u/Lekret)\
**Post date:** [October 18, 2024, 5:00pm UTC](https://qa.fmod.com/t/parameterid-as-shared-readonly-constant-value/22197/1 "2024-10-18T17:00:08Z")

</div>

Hi, I want to optimize setting parameters by using parameter id instead of name. I found that I can only retrieve PARAMETER\_ID from EventDescription.  
What I also found is that parameters with same name have same ID.  
And I have plenty of same parameters for different events, like “Speed” or “2D” for dozens of events. And I simply reuse same constant for different events.  
I see no API for retrieving parameter globally by name and type, but maybe there is an API for retrieving all events of specific bank so I can search their parameters and cache their ids?

---

<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:** [October 22, 2024, 3:06am UTC](https://qa.fmod.com/t/parameterid-as-shared-readonly-constant-value/22197/2 "2024-10-22T03:06:12Z")

</div>

Hi,

> [@Lekret](#):
>
> API for retrieving all events of specific bank

An option may be [FMOD Studio | Studio API Reference - Studio:: Bank::getEventList](https://fmod.com/docs/2.02/api/studio-api-bank.html#studio_bank_geteventlist) which will return an array of all the events added to the bank. You can retrieve a list of loaded banks with [FMOD Studio | Studio API Reference - Studio::System::getBankList](https://fmod.com/docs/2.02/api/studio-api-system.html#studio_system_getbanklist).

> [@Lekret](#):
>
> I want to optimize setting parameters by using parameter id instead of name.

Would it be possible to elaborate on this?

---

<div class="post-metadata">

**Author:** ![Lekret](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@Lekret](https://qa.fmod.com/u/Lekret)\
**Post date:** [October 23, 2024, 10:03am UTC](https://qa.fmod.com/t/parameterid-as-shared-readonly-constant-value/22197/3 "2024-10-23T10:03:03Z")

</div>

> Would it be possible to elaborate on this?

eventInstance.setParameterByName calls byteFromStringUTF8 on each call on Unity side. When I changed it to setParameterById it became 2 times faster in build.

> An option may be [FMOD Studio | Studio API Reference - Studio:: Bank::getEventList](https://fmod.com/docs/2.02/api/studio-api-bank.html#studio_bank_geteventlist) which will return an array of all the events added to the bank. You can retrieve a list of loaded banks with [FMOD Studio | Studio API Reference - Studio::System::getBankList](https://fmod.com/docs/2.02/api/studio-api-system.html#studio_system_getbanklist).

I found that, but I will have much more banks and iterating across all of banks and all of events is thing I want to avoid.  
I have cached list of bank names obtained by [BankRef] and I want to find a way to use them to get bank.  
Because from what I found I can Load/Unload bank by name, but RuntimeManager.StudioSystem.getBank can only accept path and guid. EditorRefBank has no guid, and path will probably be invalid in build (am I right?), so I’m stuck with names and I can’t use them for getting the actual Bank struct which will provide me access to all events.

---

<div class="post-metadata">

**Author:** ![zanhulme](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/zanhulme/32/5069_2.png) [@zanhulme](https://qa.fmod.com/u/zanhulme)\
**Post date:** [October 24, 2024, 6:07am UTC](https://qa.fmod.com/t/parameterid-as-shared-readonly-constant-value/22197/4 "2024-10-24T06:07:17Z")

</div>

I have been dealing with this problem by grabbing the IDs manually from the FMOD Cache and storing them in a scriptable object. It works fine, but it would save time to do it in code.

---

<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:** [October 30, 2024, 4:01am UTC](https://qa.fmod.com/t/parameterid-as-shared-readonly-constant-value/22197/5 "2024-10-30T04:01:50Z")

</div>

FMOD Studio also has the ability to build a ‘GUIDs.txt’ file (in the File menu) which contains all the guids and strings for banks, buses, events, parameters, and snapshots.
