FMOD 2.0 and the new Unity integration codes

Hey folks,

I really love the new FMOD 2.0 features and wanted to put them straight to use. Unfortunately the API changed along with the 2.0 update and therefore some of the old integration codes won’t worked anymore.

I’ve been reading the documentation and reviewed the new code examples in the “Learn” section. But as I’m not a programmer, I can’t really make sense out of it. So I was wondering if anybody can tell me how I need to replace my old codes to make things work again.

What are the new corresponding codes to the following old ones?

FMOD.Studio.ParameterInstance XXXParameter;
XXX.getParameter("PARAMETERNAME", out XXXParameter);
XXX.setParameterValue("PARAMETERNAME", 0f);

The documentation always talks about “IDs” and “Descriptions”. It seems like working with these should be better in case of performance. But how do I set an ID? How can I recall and change the value of a parameter linked to an ID? What’s the difference between an ID and a Description?

Working with names was straight forward to me, but this new ID and Description approach kinda confuses me.

After some more research I came across this:

XXX.setParameterValue("PARAMETERNAME", 1f);

is now

XXX.setParameterByName("PARAMETERNAME", 1f);

Parameter instances have been remove completely and therefore the parameter value can only be read out and stored via description. Unfortunately this more than doubles the amount of needed code !!

FMOD.Studio.ParameterInstance XXXParameter;
XXX.getParameter("PARAMETERNAME", out XXXParameter);

is now

FMOD.Studio.EventDescription XXXDescription;
FMOD.Studio.PARAMETER_DESCRIPTION ParameterDescription;
FMOD.Studio.PARAMETER_ID ParameterId;
XXXDescription = FMODUnity.RuntimeManager.GetEventDescription(XXXEvent);
XXXDescription.getParameterDescriptionByName("PARAMETERNAME", out ParameterDescription);
ParameterId =;
XXX.setParameterByID(ParameterId, 1f);

Wold be nice if anyone can confirm this.

We introduced a new parameter API in 2.0, a summary of it can be found here:

ID’s are more performant when you need to get or set a parameter multiple times.

If you are just setting a parameter once or twice then it may not be worth the work to store the description and ID, in this case you can use EventInstance::get/setParameterByName.

How much more performant is storing a description / ID compared to setting the parameter by name, so I can get a feeling for what situations it would be worth the extra work? Is it possible to measure this (like 20% faster or something like that)?

We don’t have any numbers on this, but it comes down to a series of integer comparisons vs a series of string comparisons. In general integer comparisons will always be faster than string.

Example: If you want to compare 1073741822 with 1073741823.

  • String comparison: You have to compare each of the digits one by one. This is 10 comparisons, since the integers only differ by the last digit.
  • Integer comparison: You can do this in one comparison, saving 9 comparisons as compared to the String comparison.

This is a bit simplified, naturally, but hopefully gets the point across.

Thank you very much, that helps.