I’ve just started working with FMOD in my Unity project and I’m getting this error consistently:
InvalidOperationException: Hierarchy change detected while computing layout, this is not supported. UnityEngine.UIElements.UIRLayoutUpdater.OnVersionChanged (UnityEngine.UIElements.VisualElement ve, UnityEngine.UIElements.VersionChangeType versionChangeType) (at <0dab12d45c2a4edc933579280843bdeb>:0) UnityEngine.UIElements.VisualTreeUpdater.OnVersionChanged (UnityEngine.UIElements.VisualElement ve, UnityEngine.UIElements.VersionChangeType versionChangeType) (at <0dab12d45c2a4edc933579280843bdeb>:0) UnityEngine.UIElements.Panel.OnVersionChanged (UnityEngine.UIElements.VisualElement ve, UnityEngine.UIElements.VersionChangeType versionChangeType) (at <0dab12d45c2a4edc933579280843bdeb>:0) UnityEngine.UIElements.VisualElement+Hierarchy.Clear () (at <0dab12d45c2a4edc933579280843bdeb>:0) UnityEngine.UIElements.VisualElement.Clear () (at <0dab12d45c2a4edc933579280843bdeb>:0) UnityEditor.PropertyEditor.RebuildContentsContainers () (at <c77ced6644e541b7ad3d7315a5e92a0a>:0) UnityEditor.InspectorWindow.RedrawFromNative () (at <c77ced6644e541b7ad3d7315a5e92a0a>:0) UnityEditor.AssetDatabase:StopAssetEditing() FMODUnity.EventManager:UpdateCache() (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:315) FMODUnity.EventManager:AffirmEventCache() (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:57) FMODUnity.EventManager:EventFromString(String) (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:840) FMODUnity.EventManager:EventFromPath(String) (at Assets/Plugins/FMOD/src/Editor/EventManager.cs:833) FMODUnity.StudioEventEmitterEditor:OnInspectorGUI() (at Assets/Plugins/FMOD/src/Editor/StudioEventEmitterEditor.cs:67) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
I’m using Unity 2020.3.10f1 and FMOD for Unity 2.01.09.
I seemed to have gotten rid of it by playing around with different parameters, removing and re-adding the FMOD package, re-importing assets etc. without really understanding what I was doing, just hoping for the best. But now it is back, and at this point I don’t know if I should trust my memory saying that I managed to not get it at some moment. Anyways, I was not able to either understand the problem or consistently make it go away.
The only few things I’ve managed to figure out so far are:
- It only happens if I go to play mode while having an object with FMOD Studio Event Emitter component selected in my inspector. If I have something else selected and then select and emitter during play, it works fine. The error generally does not happen at any other time than when starting game.
- Basically what’s going on is FMOD tries to refresh it’s cache on getting an Inspector GUI event and at some point it calls
AssetDatabase.StopAssetEditing()and somewhere there in the guts of Unity an error happens. This results (as far as I can inderstand) in Unity’s UI stack generally messing up so my inspector becomes useless (it only draws headers for every component but no actual UI elements) and some other errors flooding my console. I then have to re-start Unity to go back to normal. I’ve read somewhere on the web that you’re not supposed to call
AssetDatabase.StopAssetEditing()during play, so could this be the problem? Maybe environment detection is off? Or is my cache just broken?
Anyways, any help in fixing or working around this is much appreciated! Thanks in advance! Cheers!