Object reference not set to an instance of an object error using FMOD 'Trigger Enter' Play event

Hey all!

Using Unity for the first time to implement some work i’ve been doing in FMOD.

Following tutorials has been great, BUT, i cannot use the studio event emitter to trigger sounds and every time I try to attach a sound from my Event browser i get this message;

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[ ] options, System.Type layoutType) (at /Users/builduser/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:263)
UnityEngine.GUILayout.BeginHorizontal (UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[ ] options) (at /Users/builduser/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:282)
UnityEngine.GUILayout.BeginHorizontal (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[ ] options) (at /Users/builduser/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:273)
UnityEditor.Editor.DrawHeaderGUI (UnityEditor.Editor editor, System.String header, Single leftMargin) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:477)
UnityEditor.MaterialEditor.OnHeaderGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/MaterialEditor.cs:290)
UnityEditor.Editor.DrawHeader () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:355)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1108)
UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[ ] editors) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1022)
UnityEditor.InspectorWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352)
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/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

I assume that this is why (its a red exclamation mark error) the triggers aren’t working.

If anyone has a solution to this I would be very grateful. Been wondering wtf I’ve been doing wrong for the last week and getting nowhere.

V happy to give more info if needed.

Yours

very gratefully

Ed!

I’ve been having this same problem following the Survival Shooter tutorial. Everything works fine up until trying to trigger the Studio Event Emitter. Hopefully someone can provide a solution :frowning:

1 Like

Okay well i fixed it on mine not long after posting my response hah. Basically you get the nullreference because(assuming you followed the same tutorial I have) in the video it tells you to put a studio event emitter on the Hellephant asset so that the what you write in the script will trigger it. However this means that when you shoot at one of the other enemies it will return a nullreference as as they have no event emitter that is referenced in the script. So just stick an event emitter on the ZomBear and ZomBunny and use the right events and voila! Hopefully you are following the same tutorial as me and and I havent just been rambling on about nothing relevant, just really cuhffed with myself i managed to problem solve for once haha

1 Like