Not working Initial Parameter Values on FMOD Studio Event Emitter Component (Unity)

Initial Parameter Values are not override value of FMOD Studio setting value.

In FMOD Studio, I set the default value to 0.
And, I set the Initial Parameter Values on FMOD Studio Event Emitter Component to 0.5.

When I tryied to Play (By Play Event - Object Enable), The value is set to 0.
But, When I tryied to Play in code (Unity Button Event Register), It works…

How can i fix this? Please help me.

namespace Sound
{
    public class FMODParameterSlider : MonoBehaviour
    {
        [SerializeField] private StudioEventEmitter eventEmitter;
        
        [SerializeField] private Slider slider;
        [SerializeField] private string paramName;

        [SerializeField] private float paramValue;
        public float ParamValue
        {
            get => paramValue;
            set
            {
                paramValue = value;
                eventEmitter.SetParameter(_paramDesc.id, paramValue);
            }
        }

        private EventDescription _eventDesc;
        private PARAMETER_DESCRIPTION _paramDesc;

        private void Awake()
        {
            var getEventRes = RuntimeManager.StudioSystem.getEventByID(eventEmitter.EventReference.Guid, out _eventDesc);
            if (getEventRes != RESULT.OK)
            {
                throw new Exception($"Error on get event data ({eventEmitter.EventReference.Path}). Result is {getEventRes}");
            }
            var getParamRes = _eventDesc.getParameterDescriptionByName(paramName, out _paramDesc);
            if (getParamRes != RESULT.OK)
            {
                throw new Exception($"Error on get parameter data by name ({paramName}). Result is {getParamRes}");
            }
            
            ParamValue = _paramDesc.defaultvalue;
            Debug.Log($"{paramName}'s Default - {ParamValue} / Minimum - {_paramDesc.minimum} / Maximum - {_paramDesc.maximum}");
            slider.value = ParamValue;
            
            slider.onValueChanged.AddListener((value) =>
            {
                ParamValue = value;
                Debug.Log($"{paramName}'s Default - {ParamValue} / Minimum - {_paramDesc.minimum} / Maximum - {_paramDesc.maximum}");
            });
        }
    }
}

Hi,

You seem to be running into a script execution order issue. For any given script, Awake, OnEnable, and Start always execute in that order. However, it’s important to consider multiple scripts as well - the execution of Awake and OnEnable (and Update) for all scripts happens in the order specified in Project Settings → Script Execution Order, but only for that given step.

For example, Script1.Awake() will always occur before Script2.Awake(), but Script1.OnEnable() may occur before Script2.Awake(). You can read more about this in Unity’s Execution Order documentation.

If you set the Play Event of the Studio Event Emitter to “Object Start” then your script should behave as expected. This is because FMODParameterSlider.Awake() is the first thing happens when your GameObject is initialized, and StudioEventEmitter.Start() always happens afterwards since it’s execute just before the first Update.

However, because StudioEventEmitter has a higher execution priority than normal, when you use the Play Event setting “Object Enable”, StudioEventEmitter.OnEnable() can be called before FMODParameterSlider.Awake(). As a result, ParamValue = _paramDesc.defaultvalue; occurs after the “Initial Paramater Value” of 0.5 is set by the Studio Event Emitter component, overwriting it with the “Initial Value” of 0 set in FMOD Studio.

If you specifically need your Studio Event Emitter to play on “Object Enable”, then the easiest fix would be to manually play the Studio Event Emitter from FMODParameterSlider after FMODParameterSlider.Awake() has finished.