How to set Fmod Studio Advanced Settings through code?

Greetings,

I’m trying to increase the commandQueueSize using the “setAdvancedSettings” method through the RuntimeManager. Unfortunately, that seems impossible, as the advanced settings must be set before the FMODUnity.System is initialized, and invoking this line:

RuntimeManager.StudioSystem.setAdvancedSettings(newSettings);

Immediately Initializes the RuntimeManager, which in turn initializes the FMODUnity.System.

The only solution I have found is to change the settings in the RuntimeManager.cs, specifically adding these three lines past line 375 (before the studioSystem gets initialized):

studioSystem.getAdvancedSettings(out FMOD.Studio.ADVANCEDSETTINGS settings);
settings.commandqueuesize = 262144;
studioSystem.setAdvancedSettings(settings);

My question is: what’s the proper way to do this? I’d like to avoid changing FMOD classes directly if possible.

Thanks!

FMOD for Unity supports an optional Callback Handler that can be used to hook into parts of the initialization process. PreInitialize looks like what you want, as it gets called after Studio.setAdvancedSettings and before StudioSystem.initialize.

1 Like

That did it, thanks!