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

**URL:** https://qa.fmod.com/t/need-to-set-a-parameter-in-an-event-instance-cant-find-how/16683
**Category:** Unity
**Created:** [January 22, 2021, 9:37am UTC](https://qa.fmod.com/t/need-to-set-a-parameter-in-an-event-instance-cant-find-how/16683 "2021-01-22T09:37:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![laut](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/laut/32/1846_2.png) [@laut](https://qa.fmod.com/u/laut)
#### Post date: [January 22, 2021, 9:37am UTC](https://qa.fmod.com/t/need-to-set-a-parameter-in-an-event-instance-cant-find-how/16683/1 "2021-01-22T09:37:33Z")

</div>

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 !

---

<div class="post-metadata">

### Author: ![AlexM](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@AlexM](https://qa.fmod.com/u/AlexM)
#### Post date: [January 22, 2021, 10:38am UTC](https://qa.fmod.com/t/need-to-set-a-parameter-in-an-event-instance-cant-find-how/16683/2 "2021-01-22T10:38:58Z")

</div>

> [@laut](#):
>
> To set a labelled parameter on one value or another, should I use ints, since setParameter can not use strings ? Will it work ?

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

---

<div class="post-metadata">

### Author: ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)
#### Post date: [January 29, 2021, 12:02am UTC](https://qa.fmod.com/t/need-to-set-a-parameter-in-an-event-instance-cant-find-how/16683/3 "2021-01-29T00:02:35Z")

</div>

> [@laut](#):
>
> When I want to set a private ParameterInstance, like I saw on tutorials

Which tutorial are you referencing?

To set the value of a local parameter instance, you should be calling [`Studio::EventInstance::setParameterByName`](https://www.fmod.com/resources/documentation-api?version=2.1&page=studio-api-eventinstance.html#studio_eventinstance_setparameterbyname) or [`Studio::EventInstance::setParameterByID`](https://www.fmod.com/resources/documentation-api?version=2.1&page=studio-api-eventinstance.html#studio_eventinstance_setparameterbyid), as described in those sections of our documentation.

> [@laut](#):
>
> To set a labelled parameter on one value or another, should I use ints, since setParameter can not use strings ? Will it work ?

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.

> [@laut](#):
>
> 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()” ?

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.
