Parameter Event Instance always plays sound set as initial value together with (correctly selected) sound from parameter

I’m using FMOD to play an event, the event has multiple parameters and a sound for every event.

When playing from code, the initial value always plays along with the correct value selected by the parameter, the initial value sound is a long loop which is why it’s so noticeable.

This is the code that sets the parameters, it’s called once, parameters are correct, all the set-calls returns “OK” results.

private void PlayLooping(Source source, List<(string, string)> parameters)
{
    StopLooping(source);

    if (sources[source] == null)
        return;

    EventInstance instance = RuntimeManager.CreateInstance(master);
    RuntimeManager.AttachInstanceToGameObject(instance, sources[source].transform);

    if (instances.ContainsKey(source))
        instances[source] = instance;
    else
        instances.Add(source, instance);

    for (int i = 0; i < parameters.Count; i++)
    {
        FMOD.RESULT result = instance.setParameterByNameWithLabel(parameters[i].Item1, parameters[i].Item2);
        Debug.Log($"{parameters[i].Item1} set to {parameters[i].Item2}, result: {result}");
    }

    Debug.Log($"Playing: {source}");
    instance.start();
}

This is my event setup.

What happens is that the idle-loop ALWAYS play, regardless if the parameters is set before/after start, or if the parameters change.
The correct sound also plays.

Setting the parameter initial value to an empty slot, such as “Death” or “Hurt” stops the Idle-loop from playing.

What am I doing wrong?

Hi,

Can I please grab your integration version?

Can you please try starting the instance before setting the parameter:

private void PlayLooping(Source source, List<(string, string)> parameters)
{
    StopLooping(source);

    if (sources[source] == null)
        return;

    EventInstance instance = RuntimeManager.CreateInstance(master);

    Debug.Log($"Playing: {source}");
    instance.start();

    RuntimeManager.AttachInstanceToGameObject(instance, sources[source].transform);

    if (instances.ContainsKey(source))
        instances[source] = instance;
    else
        instances.Add(source, instance);

    for (int i = 0; i < parameters.Count; i++)
    {
        FMOD.RESULT result = instance.setParameterByNameWithLabel(parameters[i].Item1, parameters[i].Item2);
        Debug.Log($"{parameters[i].Item1} set to {parameters[i].Item2}, result: {result}");
    }
}

The issue may be that the instance is not valid yet which is confusing why it is returning FMOD_OK. You can confirm that an instance is valid with instance.isValid().

Hope this helps.