Question about Studio::EventInstance::setParametersByIDs

Hello !

I am using Studio::EventInstance::setParametersByIDs to apply a bunch of parameters to some event instances.

The arrays of parameter ids and values used as arguments are shared between the event instances for optimization purposes but not all event instances supports all parameters.

From my tests, it seems that this function fails as soon as it reaches a parameter that doesn’t exist on the event instance and stops instead of simply skipping it.

Is that a bug or the intended behavior ?
Thanks in advance for anyone that can answer :slight_smile:

That is correct, attempting to set any non-zero parameter ids that do not exist on the event will result in the entire call failing. This is intended behavior for exception safety reasons, but I can see how it would be undesirable to have successful param changes rolled back in your case. Perhaps an option to disable the rollback behavior which allows non-applicable param ids to be skipped in the same way as zeroed ids would be better?
For now, simplest workaround I can think of would be to pass in a a new param array into the call and grab the applicable values from your global array. Less than optimal though if that’s your goal.

This is what I suspected when I noticed the behaviour.
An option to ignore non applicable param ids would be great indeed.

As a workaround I just loop over the array and set each parameter individually, ignoring eventual errors.
I don’t get the performance benefits of doing a single call to the FMOD API but it works.

Thanks for your quick answer!

Good to hear you’ve got a workaround, hopefully the performance impact isn’t noticeable. I have passed the suggestion along to the Dev team, thank you for bringing this to our attention!