# Parameter final value is not changing

**URL:** <https://qa.fmod.com/t/parameter-final-value-is-not-changing/22806>\
**Category:** FMOD Studio\
**Tags:** unity\
**Created:** [April 15, 2025, 10:35am UTC](https://qa.fmod.com/t/parameter-final-value-is-not-changing/22806 "2025-04-15T10:35:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hardsmoke](https://avatars.discourse-cdn.com/v4/letter/h/e9a140/32.png) [@hardsmoke](https://qa.fmod.com/u/hardsmoke)\
**Post date:** [April 15, 2025, 10:35am UTC](https://qa.fmod.com/t/parameter-final-value-is-not-changing/22806/1 "2025-04-15T10:35:13Z")

</div>

Hello.  
I try to change the value of the parameter during runtime, but the final value does not change for some reason and because of this the parameter does not affect the sound in any way.

I also noticed that if I set the “Persistent” parameter to “On”, everything works. Should I leave this parameter enabled or am I doing something wrong?

```auto
using FMODUnity;
using UnityEngine;

public class Test : MonoBehaviour
{
    public StudioEventEmitter emitter;
    public float value = 1.0f;

    [ContextMenu("SetParameterAndPlay")]
    private void SetParameterAndPlay()
    {
        emitter.EventInstance.setParameterByName("RestSecondsToNight", value);
        emitter.EventInstance.getParameterByName("RestSecondsToNight", out float a, out float b);
        emitter.Play();

        UnityEngine.Debug.Log($"value: {a}"); // print right value
        UnityEngine.Debug.Log($"final value: {b}"); // print 10 (default value)
    }
}

```

 ![Actions Sheet](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/a/a023732bf5d3babd02c04c2a05e05e7adc270e09.png)

 ![Parameter Sheet](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/2/2f3b16c30ef5405209c72ec0d1d4f632673cb957.png)

 ![Parameter](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/9/9636f5a3e032088b2004d510fb9cd82cc1f28938.png)

Thanks.

---

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [April 22, 2025, 12:43am UTC](https://qa.fmod.com/t/parameter-final-value-is-not-changing/22806/2 "2025-04-22T00:43:43Z")

</div>

Hi,

Thank you for sharing the detailed setup, and sorry for the late response.

> [@hardsmoke](#):
>
> I also noticed that if I set the “Persistent” parameter to “On”, everything works. Should I leave this parameter enabled or am I doing something wrong?

`finalvalue` represents the fully processed value of the parameter after applying adjustments due to automation, modulation, seek speed, and parameter velocity to value. This is calculated asynchronously when the studio system updates.

To ensure the parameter value is fully applied without enabling the [Persistent](https://www.fmod.com/docs/2.03/studio/event-macro-controls-reference.html#persistent) setting, could you please try calling [Studio::System::flushCommands](https://www.fmod.com/docs/2.03/api/studio-api-system.html#studio_system_flushcommands) right after `setParameterByName`? This forces the system to process all pending changes right away.

Also, make sure to set the parameter after calling `emitter.Play()`, so that you’re applying the value to the currently active event instance.

For example:​

```auto
using FMODUnity;
using UnityEngine;

public class Test : MonoBehaviour
{
    public StudioEventEmitter emitter;
    public float value = 1.0f;

    [ContextMenu("SetParameterAndPlay")]
    private void SetParameterAndPlay()
    {
        emitter.Play();
        emitter.EventInstance.setParameterByName("RestSecondsToNight", value);
        RuntimeManager.StudioSystem.flushCommands();
        emitter.EventInstance.getParameterByName("RestSecondsToNight", out float a, out float b);

        UnityEngine.Debug.Log($"value: {a}"); // print right value
        UnityEngine.Debug.Log($"final value: {b}"); // print 10 (default value)
    }
}

```

Hope this helps, let me know if the issue persists.

---

<div class="post-metadata">

**Author:** ![hardsmoke](https://avatars.discourse-cdn.com/v4/letter/h/e9a140/32.png) [@hardsmoke](https://qa.fmod.com/u/hardsmoke)\
**Post date:** [April 24, 2025, 6:48am UTC](https://qa.fmod.com/t/parameter-final-value-is-not-changing/22806/3 "2025-04-24T06:48:10Z")

</div>

Indeed, changing the execution order helped. You need to first execute emitter.Play and only then change the variables. Thanks
