# Cant change event parameter

**URL:** <https://qa.fmod.com/t/cant-change-event-parameter/19238>\
**Category:** Unity\
**Created:** [September 4, 2022, 12:16pm UTC](https://qa.fmod.com/t/cant-change-event-parameter/19238 "2022-09-04T12:16:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![justinsane](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@justinsane](https://qa.fmod.com/u/justinsane)\
**Post date:** [September 4, 2022, 12:16pm UTC](https://qa.fmod.com/t/cant-change-event-parameter/19238/1 "2022-09-04T12:16:56Z")

</div>

Hello,

i cant change the parameter of a simple sound with FMOD. Iam new in fmod and trying to move my project into the FMOD space.

I created an FMOD Event Emitter and attached an event to it. The Event has an integer parameter which will change the used sounds.

iam trying to access the integer value like this:

```
        playerController.playerCore.m_eventEmitter.SetParameter("Terrain", 1);
        playerController.playerCore.m_eventEmitter.Play();

```

It always stays at “0” so it plays concrete footstep sounds. while 1 should be the wooden sound. When iam in unity and get onto the event with the event browser, everything works flawless.

How can i adjust the parameter via script?

When i change the slider manually it works. Even why i try to use the parameter script the changes wont take effect. iam using unity 2019.4.40f lts

EDIT: I tried to catch the value with:

```
                    emitterRef.Target.EventInstance.getParameterByName("Terrain", out float value);
                    {
                        Debug.Log("Triggered: " + value);
                    }

```

and its showing the correct value, but the sound isnt changing. This seems strange…

![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/6/6fd9b4b19f8ff016765fd5d7450f8ababe9ed294.png)

Thank you for your time.

---

<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:** [September 7, 2022, 12:59am UTC](https://qa.fmod.com/t/cant-change-event-parameter/19238/2 "2022-09-07T00:59:52Z")

</div>

Hi,

You were super close to getting it right. The problem is you are trying to set the parameter on an `event instance` that hasn’t been created yet.

The [StudioEventEmitter.Play()](https://fmod.com/docs/2.02/unity/api-studioeventemitter.html#studioeventemitter_play) function creates and plays a new instance of the event. A deeper explanation of Event Instances is under [Glossary | Event Instance](https://fmod.com/docs/2.02/studio/glossary.html#event-instance).

To solve the problem change the `Play()` and `SetParameter()` positions like this:

```auto

playerController.playerCore.m_eventEmitter.Play();

playerController.playerCore.m_eventEmitter.SetParameter("Terrain", 1);

```

No we are creating a new instance of the event, then setting the Terrain parameter.

Hope this helps!
