[iOS] Frequent SystemNotInitializedException

I cannot reproduce this exception on our test devices, but we frequently have the following exceptions sent to Unity performance reports service:
SystemNotInitializedException: FMOD Studio initialization failed : Calling initialize : ERR_OUTPUT_INIT : Error initializing output device.

Occurring on all versions of iOS and devices, with FMOD 1.09.06

Any idea why it couldn’t initialize the output device ?

Normally this is caused by a conflict between Unity’s inbuilt audio and the FMOD integration. This can be avoided by disabling the Unity inbuilt audio, steps can be found here:
https://fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/troubleshooting.html#/

Thank you for your reply, unfortunately I already had disabled Unity Audio ticking that option. Any other leads ?

The only other issue I can think of is if the app is suspended/sent to the background while it is starting up (during FMOD’s initialization). To avoid this you can enable the settings for background audio which will allow FMOD to init if suspended, but will still pause the sounds due to Unity and code in the RuntimeManager.cs.

https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionBasics/AudioSessionBasics.html

The error isn’t reproducible, but is fairly common. We’re seeing it during development with a small number of users. Any more feedback on what is going on would be appreciated ( or confirmation of a fix ).

Previously if the system failed to init, every time you tried to access it you would get an exception, making it hard to determine the cause.
In the latest versions, 1.09.08 & 1.10.00, we changed it to throw the exception once and then set the system to no sound mode. This is not a fix, just nicer.

I’m not sure what the fix would be without seeing more information on the specific error as there could be a number of causes. The couple I mentioned above are just the most common, and are out of our control to ‘fix’.

Will there be logs in addition to this error that will help diagnose? How can I gather more information about what is happening?

Will there be logs in addition to this error that will help diagnose? How can I gather more information about what is happening?

You can add extra flags to the FMOD Debug init in the RuntimeManager.cs, to look like this:

FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG | FMOD.DEBUG_FLAGS.TYPE_TRACE, FMOD.DEBUG_MODE.FILE, null, RuntimeUtils.LogFileName);

This should provide more information about the errors. If you could provide the log files, either here or to support@fmod.com, we can take a look for you.

changed the code by commenting out #define

got this error
03:47:19 [Exception] SystemNotInitializedException: FMOD Studio initialization failed : Applying debug settings : ERR_UNSUPPORTED : A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. FMODUnity.RuntimeManager.CheckInitResult (RESULT result, System.String cause)
FMODUnity.RuntimeManager.Initialiase (Boolean forceNoNetwork)
FMODUnity.RuntimeManager.get_Instance ()
FMODUnity.RuntimeManager.LoadBank (System.String bankName, Boolean loadSamples)
FMODUnity.StudioBankLoader.Load ()
FMODUnity.StudioBankLoader.HandleGameEvent (LoaderGameEvent gameEvent)
FMODUnity.StudioBankLoader.Start ()

Is this supported on IOS at all?
(since I had to comment out the define)

Do I need to set the DEVELOPMENT_BUILD #define?

//#if UNITY_EDITOR || ((UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && DEVELOPMENT_BUILD)
result = FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG | FMOD.DEBUG_FLAGS.TYPE_TRACE, FMOD.DEBUG_MODE.FILE, null, RuntimeUtils.LogFileName);
if (result == FMOD.RESULT.ERR_FILE_NOTFOUND)
{
#if UNITY_5_X
Debug.LogErrorFormat(“FMOD Studio: Cannot open FMOD debug log file ‘{0}’, logs will be missing for this session.”, System.IO.Path.Combine(Application.dataPath, RuntimeUtils.LogFileName));
#else
Debug.LogError(string.Format(“FMOD Studio: Cannot open FMOD debug log file ‘{0}’, logs will be missing for this session.”, System.IO.Path.Combine(Application.dataPath, RuntimeUtils.LogFileName)));
#endif
}
else
{
CheckInitResult(result, “Applying debug settings”);
}
//#endif

Any progress on this so far?
I’m also getting this error from Unity performance reporting:
FMOD Studio initialization failed : Calling initialize : ERR_OUTPUT_INIT : Error initializing output device.

Disabling unity audio has the problem that all other audio sources are muted. It is not possible (as of my knowledge) to set the audio session yourself before showing the splash screen:
https://www.fmod.org/questions/question/mute-audio-sources-option-ignored-when-disabling-unity-audio/#sabai-entity-content-46782

We are currently looking into this and will hopefully have a solution soon.

In FMOD Studio version 1.09.07 we limited the number of exceptions thrown from this issue by re-initializing in no sound mode. This is by no means a fix for the cause of the exception but it does stop the error spam.

We currently have a solution planned for a future release, although it does require reworking some of the LowLevel init system for iOS, unfortunately we don’t have a time frame for this at the moment.

Hello Cameron! I’m doing a little research, trying to decide whether to use FMOD for an iOS project. Would you happen to have an update on this issue? Thank you!

This task has not been scheduled as of yet and I’m unable to speculate at a time frame at this point.

Thank you for your answer! And wow, it’s been quite a while since it was reported, I assume few people that use FMOD on iOS encounter it?

Hi, any update on this?
I’m having the exact same problem on iOS, it’s intermittent but seems to be far more common in development builds.

Worth noting that this is with FMOD 2.00.02, never encountered this with the previous version (1.9.something).

Any help appreciated.
Thanks!

In development build you will see an error from FMOD.Debug.Initialize if the logging library has not been selected instead of the release library. I have added a new section to the docs for handling this: https://fmod.com/resources/documentation-unity?version=2.0&page=platform-specifics.html#fmod-libs-on-static-platforms