FMOD Parameter Trigger not updating parameter in Unity

I’m working on a client’s game and I’m having trouble triggering a parameter change.

The game has a prefab called DarkMatter which triggers my local Perk parameter to update when the prefab is created. The emitter using this parameter is on the PegBasic prefab which triggers on Collision Enter 2D.

The parameter doesn’t seem to update, though manually changing the parameter on a PegBasic object does work and the sound plays as expected.

The sounds are managed in a dedicated Perk Manager event with a parameter sheet.

Hi,

Thanks for the detailed screenshots!

From what I can see, the issue might caused by timing: your Studio Parameter Triggers fire on Object Start/Disable, but the Studio Event Emitter on PegBasic only creates the event instance on Collision Enter 2D. When the triggers run, there’s no instance yet, so the local Perk parameter isn’t applied. Later, when the collision occurs and the instance is finally created, it uses the event’s default parameter value, which makes it seem like the parameter change didn’t work.

For reference, a similar discussion can be found here: Changing Paremeters in Unity From Code - #2 by Leah_FMOD

Thanks for your input! That makes sense and I’ve changed the PegBasic prefab to trigger on ObjectStart, though no change. I’ve checked the specific instance of the peg to see if it updates, though the parameter is still None.

I also tried removing an initial parameter value from the PegBasic prefab, though this didn’t help. Is this something I’ll need to change in the code? I popped a couple of debugging messages in the Play() and TriggerParameters() functions and it revealed Play() isn’t actually running at all, not even when the trigger is Object Start.

Thank you for sharing the extra info.

Could you please share a small code snippet showing how/where you play the sound (e.g., the Play() call and any parameter writes)? That’ll help me see the timing/order.

Also, could you please set Logging Level to Log and Enable API Error Logging (FMOD → Edit Settings), then try to play the sound and attach the full log so I can take a closer look?

Sure, here’s what I found:

StudioEventEmitter.cs

public void Play()

        {

// UnityEngine.Debug.Log($"[FMOD] Play called on Event Emitter with Event '{EventReference.Path}'");

if (TriggerOnce && hasTriggered)

            {

return;

            }




if (EventReference.IsNull)

            {

return;

            }




cachedParams.Clear();




if (!eventDescription.isValid())

            {

Lookup();

            }




bool isSnapshot;

eventDescription.isSnapshot(out isSnapshot);




if (!isSnapshot)

            {

eventDescription.isOneshot(out isOneshot);

            }




bool is3D;

eventDescription.is3D(out is3D);




IsActive = true;




if (is3D && !isOneshot && Settings.Instance.StopEventsOutsideMaxDistance)

            {

RegisterActiveEmitter(this);

UpdatePlayingStatus(true);

            }

else

            {

PlayInstance();

            }

        }

I tried adding some debug logs in StudioParameterTrigger.cs to figure out where exactly the issue is. Even when setting the PegBasic event emitter trigger to Object Start, the target (PegBasic) is never valid and the the parameter never triggers.

public void TriggerParameters()

        {

for (int i = 0; i < Emitters.Length; i++)

            {

var emitterRef = Emitters[i];

UnityEngine.Debug.Log($"[FMOD] Trigger Parameter Target: {emitterRef.Target}. Target Valid: {emitterRef.Target.EventInstance.isValid()}.");

// FIXME: Perks don't update local Perk parameter for PegBasic - isValid() is

if (emitterRef.Target != null && emitterRef.Target.EventInstance.isValid())

                {

for (int j = 0; j < Emitters[i].Params.Length; j++)

                    {

emitterRef.Target.EventInstance.setParameterByID(Emitters[i].Params[j].ID, Emitters[i].Params[j].Value);

                    }

                }

            }

        }

Editor.log (3.6 MB)

Hopefully this is the correct log.