FMOD Unity Integration OnGUI errors (Asset Serialization mode?)


we have started getting errors with our FMOD Unity integration in the editor recently.
We are using Unity 5.2.4f1 and the FMOD Studio Unity Integration 1.08.04. We are not doing any specific platform build, just working for Windows on a PC.

It looks like it has something to do with the OnGUI events. The errors we get on the console are these ones:

It happens when we use a parameter on our own scripts (for example, having a [FMODUnity.EventRef] public string):

NullReferenceException: Object reference not set to an instance of an object
FMODUnity.EventRefDrawer.OnGUI (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Plugins/Editor/FMOD/EventRefDrawer.cs:53)
UnityEditor.PropertyDrawer.OnGUISafe (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyDrawer.cs:23)
UnityEditor.PropertyHandler.OnGUI (Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, Boolean includeChildren) (at C:/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:134) …

Or when trying to look at an item on the Event Browser from the FMOD top menu:

NullReferenceException: Object reference not set to an instance of an object
FMODUnity.EventBrowser.PreviewEvent (Rect previewRect, FMODUnity.EditorEventRef selectedEvent) (at Assets/Plugins/Editor/FMOD/EventBrowser.cs:651)
FMODUnity.EventBrowser.OnGUI () (at Assets/Plugins/Editor/FMOD/EventBrowser.cs:473)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

At first we didn’t have this issues for a long time using the integration, but now the only thing that I can think of that can have some relation to when it started happening, is that we changed the Asset Serialization Mode to “Force Text”.

Could this be the reason for the error showing up now? I’ve been looking around but haven’t seen anything that solves the problem. The most similar thing that I’ve found is this issue: , but it’s been 3 years since that and, as the answer suggests, I think that problem would be solved now.

Has anybody faced a similar error or know how to solve this?
Thank you very much!

Well, it seems like I have solved the issue.

I deleted every FMOD folder and file from the Unity project, then downloaded the integration and imported it again (having the Asset Serialization to Force Text from the beginning). Now it runs completely fine.

What I think it happened is that when changing the Asset Serialization mode to Force Text, something went wrong and corrupted some file maybe? Changing the mode without doing anything else didn’t solve the issue. Installing again the integration without deleting anything didn’t solve the issue neither. Deleting everything, then reimporting the integration and setting it again did solve it.

1 Like

For me, it happened when I moved the “Editor Default Resources” folder from Assets into another folder where I put all the asset-store packages in order to keep my root Assets folder clean.

So I had to put it back into Assets and it works now.


We have WINNER!

in my case, i accidentally move folder.
move it back, solve the problem

I ran into this problem because someone else on my project was cleaning up and moving things around. I didn’t realise at first because I assumed it was something I had done, but it was Editor Default Resources being in the wrong place. For future visitors to this thread: the Editor Default Resources folder needs to be in the project’s root Assets folder, or it chucks a wobbly.

Thanks for sharing, we are looking into getting rid of that directory with the goal of having all FMOD integration files contained within a single folder that can be moved.