What is the right way to re-initialize fmod system in unity?

Hi! I write code with fmod in unity and build it for android platform.

This code

FMODUnity.RuntimeManager.CoreSystem.setOutput(FMOD.OUTPUTTYPE.WAVWRITER_NRT);
FMODUnity.RuntimeManager.CoreSystem.init(128, FMOD.INITFLAGS.STREAM_FROM_UPDATE, IntPtr.Zero);

works in editor in windows, but not works in android.

I check return code, and was surprized that both strings produce ERR_INITIALIZED error. This error told me that I can’t put this strings after init() of system. Ok. But I don’t call init() by myself. Probably, it’s mean that system in unity is initialiazed at start of scene or something like this.

It’s ok. But I need in one scene normal fmod behavior, then FMOD.OUTPUTTYPE.WAVWRITER_NRT behavior, then normal again.

So I need re-initialize system someway.

From user manual I understand that I can close() connection with fmod and then init() system again with my flags. OK! But when I put this code:

FMODUnity.RuntimeManager.CoreSystem.close();
FMODUnity.RuntimeManager.CoreSystem.setOutput(FMOD.OUTPUTTYPE.WAVWRITER_NRT);
FMODUnity.RuntimeManager.CoreSystem.init(128, FMOD.INITFLAGS.STREAM_FROM_UPDATE, IntPtr.Zero);

All strings return FMOD_OK. But after a few seconds applications crash and unity crash too!

I can’t understand what is going on. Please, help me to understand.

What is the right way to re-initialize fmod system in unity?

Thanks!

The reason of unity crashing is enabled Live update option in fmod settings. I disable it, unity don’t crush now.

But I still search answer for my question.

At that moment this code

FMODUnity.RuntimeManager.CoreSystem.close();
FMODUnity.RuntimeManager.CoreSystem.setOutput(FMOD.OUTPUTTYPE.WAVWRITER_NRT);
FMODUnity.RuntimeManager.CoreSystem.init(128, FMOD.INITFLAGS.STREAM_FROM_UPDATE, IntPtr.Zero);

return OK on every string of code. But next string

myInstance = FMODUnity.RuntimeManager.CreateInstance(AudioEvent);

give me new errors, coming from deep of dll library:

[FMOD] assert : assertion: ‘isEmpty()’ failed
[FMOD] assert : assertion: ‘realInstance’ failed

Can somebody explain what I can do with this errors?

My questions is still here: what is the right way to re-initialize fmod system in unity?

Need help please! Is this QA-forum still alive?

The main issue is that you are tearing down the Core System out from underneath the Studio API, which is not supported.

You would have to release and re-initialize the Studio System as well as the Core System, anything created or loaded in the old system will be lost and needs to be recreated. Depending on your use case, you may be able to create a separate system that you can use for NRT that can be kept separate from the RuntimeManager.