ParameterID as shared readonly/constant value

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?

Hi,

An option may be FMOD Studio | Studio API Reference - 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.

Would it be possible to elaborate on this?

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 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.

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.

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.

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.

2 Likes