Need to set a parameter in an Event Instance - Can't find how

Hello !

I have a ‘footstep’ event, with a labelled parameter that can be set as ‘isAlly’ or ‘isEnemy’ .
I have two questions :

  • When I want to set a private ParameterInstance, like I saw on tutorials, Visual Studio can not find the type or namespace. I can only assign PARAMETER_ID, PARAMETER_FLAGS, PARAMETER TYPE and PARAMETER_DESCRIPTION , even if my script uses MonoBehaviour. Did I miss something ?

  • To set a labelled parameter on one value or another, should I use ints, since setParameter can not use strings ? Will it work ?

  • What’s the best method ? Declaring public parameters, creating their instances at the same time as the event instances, or setting their parameters by name like “event.setParameterByName()” ?

Sorry for the noob questions, and thanks for reading !

Yes, it’s the only way to go, it will work.

For the other questions, I’m not qualified to answer! But in your exemple, since there’s only two cases, an alternative way is to create 2 super events FootstepsAlly and FootstepsEnemy, which you nest your Footstep event in, and you set the right parameter internally in FMOD with a Command Instrument. That’s personal but I quite like this type of workflow of multi-nested instruments (thus reducing the coding above).

Which tutorial are you referencing?

To set the value of a local parameter instance, you should be calling Studio::EventInstance::setParameterByName or Studio::EventInstance::setParameterByID, as described in those sections of our documentation.

Under the hood, parameter values are floating point variables. As of the time of writing (January of 2021), it is not possible to set a labelled parameter in code by specifying the label of the value you want to set it to. Instead, you must set the parameter to the number that corresponds to that label. You can see the numbers that correspond to each label of a labelled parameter in FMOD Studio, by viewing the list of labels in the edit parameter dialog.

I’m not sure what you mean by “public parameters,” as that term is not used in our documentation.

Do you mean global parameters? If so, the method you propose will not help, as all instances of a global parameter share the same value.

If you mean parameters whose values are exposed recursively via event instruments, that property has no direct bearing on how easy it is to set their values via code, unless you are using those parameters in event instruments.

In any case, the “best” method is subjective, and differs depending on the unique requirements of every game project.