FMOD crashes in Unity Profiler (Standalone Process)

Opening the standalone profiler via Window->Analysis->Profiler (Standalone) on my project has FMOD blowing chunks on me:

UnityException: Creating asset at path Assets/Plugins/FMOD/Cache/Editor/FMODStudioCache.asset failed.
FMODUnity.EventManager.UpdateCache () (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:74)
FMODUnity.EventManager.RefreshBanks () (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:30)
FMODUnity.EventManager.Startup () (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:486)
UnityEngine.Debug:LogException(Exception)
FMODUnity.EventManager:Startup() (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:490)
UnityEditor.EditorApplication:Internal_CallDelayFunctions()

What can I do? I can’t have errors in my log because this profiler process is part of an automated test, but it also happens when I try to use it interactively as described above.

I couldn’t reproduce this with the latest version of FMOD- which versions of FMOD and Unity do you have?
Does it make a difference if you set Logging Level to “None” in the FMOD integration settings? That might not be particularly useful in the context of automated tests though.

Thanks for the quick response - only getting around to this now. I can trivially and 100% reproduce this for FMOD for Unity 20.1.11 in an empty 3D project. Please refer the to the sample project linked at the bottom; and in Unity 2021.1.17f1 (for example), select Window->Analysis->Profiler (Standalone Process).

The error messages slightly vary between Enter Play Mode Options (in Project settings) being on (no domain reload, no scene reload) and default EMOs (domain reload, scene reload), but there is an error raised in either case and whether the projects is a small sample or has more events. Bug reproduces in URP as well as Builtin Renderer projects.


Link to project: FMOD-Profiler-Bug.zip - Google Drive (it naturally contains FMOD, so it’s 160 MB packed - technically, there is nothing in it but fmod, a fresh 3D template project, and a .fspro … btw, I would love to see FMOD in a true UPM package some day :slight_smile: )

I suspect the underlying problem is that the standalone profiler is a separate Unity process working on the same folders, and FMOD doesn’t play nicely with that. (for that matter, FMOD also doesn’t play nicely with even itself in just one and the same project, I can’t build my FMOD Studio banks while in playmode, for example - big bummer every time)

Hope this helps you find the bug(s) behind these problems! :smiley:

Thanks for the repro- sure enough I have gotten the same error messages as you.
It looks like there is a known issue with accessing the AssetDatabase from the Standalone Profiler, I have raised this with the Dev team to look into a fix.
In the meantime, I have a workaround to bypass AssetDatabase access while the profiler window is in view. You can modify RefreshBanks() in “Assets\Plugins\FMOD\src\Editor\EventManager.cs” at line 28 to the following:

public static void RefreshBanks()
{
    if (EditorWindow.HasOpenInstances<ProfilerWindow>())
    {
        return;
    }
    
    string result = UpdateCache();
    OnCacheChange();
    if (Settings.Instance.ImportType == ImportType.AssetBundle)
    {
        UpdateBankStubAssets(EditorUserBuildSettings.activeBuildTarget);
    }

    BankRefresher.HandleBankRefresh(result);
}

I am not sure what the potential ramifications are in the context of your automated tests, but I have found this at least prevents the errors and allows normal usage of FMOD in the Editor.
Interesting point on building banks while in play mode, I can definitely see how that could reduce iteration time- I’ll add it as a suggestion!