# Change parameter by ID not working

**URL:** https://qa.fmod.com/t/change-parameter-by-id-not-working/15866
**Category:** Unity
**Created:** [June 9, 2020, 3:33am UTC](https://qa.fmod.com/t/change-parameter-by-id-not-working/15866 "2020-06-09T03:33:14Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![MikeMeyers](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@MikeMeyers](https://qa.fmod.com/u/MikeMeyers)
#### Post date: [June 9, 2020, 3:33am UTC](https://qa.fmod.com/t/change-parameter-by-id-not-working/15866/1 "2020-06-09T03:33:15Z")

</div>

Hi, below is a script that I have attached to my character, and everything in the script is working except for the part that sets the parameter. It is playing the default parameter value 0, rather than 4, every time PlayFootstep is called:

using System.Collections;  
using System.Collections.Generic;  
using UnityEngine;

public class CharacterSounds : MonoBehaviour  
{  
[FMODUnity.EventRef]  
public string inputsound;  
FMOD.Studio.EventInstance sound1;  
[FMODUnity.EventRef]  
public string inputsound2;  
FMOD.Studio.EventInstance sound2;  
FMOD.Studio.PARAMETER\_ID surfaceID;

```
void Start()
{

    FMOD.Studio.EventDescription eventDescription;
    sound1.getDescription(out eventDescription);
    FMOD.Studio.PARAMETER_DESCRIPTION surfaceDescription;
    eventDescription.getParameterDescriptionByName("Surface", out surfaceDescription);
    surfaceID = surfaceDescription.id;
}

void PlayFootstep()
    {
    float valu = 4;
    sound1 = FMODUnity.RuntimeManager.CreateInstance(inputsound);
    sound1.setParameterByID(surfaceID, (float)valu);
    sound1.start();
    FMODUnity.RuntimeManager.AttachInstanceToGameObject(sound1, GetComponent<Transform>(), GetComponent<Rigidbody>());
}      

```

}

---

<div class="post-metadata">

### Author: ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)
#### Post date: [June 9, 2020, 9:24am UTC](https://qa.fmod.com/t/change-parameter-by-id-not-working/15866/2 "2020-06-09T09:24:49Z")

</div>

I think you are trying to call getDescription on sound1, but that instance only get’s created when you call PlayFootstep. Try to move the parameter code below the instance creation or maybe call FMODUnity.RuntimeManager.GetEventDescription to get the EventDescription instead.

---

<div class="post-metadata">

### Author: ![MikeMeyers](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@MikeMeyers](https://qa.fmod.com/u/MikeMeyers)
#### Post date: [June 9, 2020, 10:44am UTC](https://qa.fmod.com/t/change-parameter-by-id-not-working/15866/3 "2020-06-09T10:44:15Z")

</div>

I previously had these lines:

FMOD.Studio.EventDescription eventDescription;  
sound1.getDescription(out eventDescription);  
FMOD.Studio.PARAMETER\_DESCRIPTION surfaceDescription;  
eventDescription.getParameterDescriptionByName(“Surface”, out surfaceDescription);  
surfaceID = surfaceDescription.id;

in void update like the API manual suggests, and it did not work that way either. What is the difference between getDescription and getEventDescription?

---

<div class="post-metadata">

### Author: ![MikeMeyers](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@MikeMeyers](https://qa.fmod.com/u/MikeMeyers)
#### Post date: [June 9, 2020, 11:02am UTC](https://qa.fmod.com/t/change-parameter-by-id-not-working/15866/4 "2020-06-09T11:02:52Z")

</div>

Moving the parameter code below the instance creation in void PlayFootsteps also does not change the problem.

---

<div class="post-metadata">

### Author: ![MikeMeyers](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@MikeMeyers](https://qa.fmod.com/u/MikeMeyers)
#### Post date: [June 9, 2020, 11:37am UTC](https://qa.fmod.com/t/change-parameter-by-id-not-working/15866/5 "2020-06-09T11:37:18Z")

</div>

it is a global parameter fyi

---

<div class="post-metadata">

### Author: ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)
#### Post date: [June 9, 2020, 12:02pm UTC](https://qa.fmod.com/t/change-parameter-by-id-not-working/15866/6 "2020-06-09T12:02:39Z")

</div>

For global parameters you might want to look at [Studio::System::getParameterDescriptionByName](https://fmod.com/resources/documentation-api?version=2.0&page=studio-api-system.html#studio_system_getparameterdescriptionbyname) and [Studio::System::setParameterByID](https://fmod.com/resources/documentation-api?version=2.0&page=studio-api-system.html#studio_system_setparameterbyid). Global parameters exists on global basis on the System object as detailed here: [https://www.fmod.com/resources/documentation-api?version=2.0&page=studio-guide.html#setting-parameters](https://www.fmod.com/resources/documentation-api?version=2.0&page=studio-guide.html#setting-parameters)  
You can get the Studio System object through the RuntimeManager in Unity. The code would look like this if I remember correctly:

> FMOD.Studio.PARAMETER\_DESCRIPTION surfaceDescription;  
> FMODUnity.RuntimeManager.StudioSystem.getParameterDescriptionByName(“Surface”, out surfaceDescription);  
> surfaceID = surfaceDescription.id;

then you just call:

> FMODUnity.RuntimeManager.StudioSystem.setParameterByID(surfaceID, value);
