UnityEngine.Bindings.ThrowHelper.ThrowNullReferenceException (System.Object obj) [0x00018] Error on Windows Build

My project is working fine in editor, however when I generate a IL2CPP and Mono build I get the following error when I press any UI element:

NullReferenceException: Object reference not set to an instance of an object.
  at UnityEngine.Bindings.ThrowHelper.ThrowNullReferenceException (System.Object obj) [0x00018] in C:\build\output\unity\unity\Runtime\Export\Scripting\BindingsHelpers.cs:62 
  at UnityEngine.Component.get_gameObject () [0x00006] in <acbc7a8432b24944a0e1db033a70c02a>:0 
  at LobbyCreateUI.Show () [0x00001] in C:\Users\LobbyTutorial\Scripts\LobbyCreateUI.cs:97 
  at LobbyListUI.CreateLobbyButtonClick () [0x00001] in C:\Users\homepc\project\Assets\LobbyTutorial\Scripts\LobbyListUI.cs:73 
  at UnityEngine.Events.InvokableCall.Invoke () [0x00010] in C:\build\output\unity\unity\Runtime\Export\UnityEvent\UnityEvent.cs:178 
  at UnityEngine.Events.UnityEvent.Invoke () [0x00022] in C:\build\output\unity\unity\artifacts\generated\UnityEvent\UnityEvent_0.cs:57 
  at UnityEngine.UI.Button.Press () [0x00027] in .\Library\PackageCache\com.unity.ugui\Runtime\UGUI\UI\Core\Button.cs:70 
  at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00010] in .\Library\PackageCache\com.unity.ugui\Runtime\UGUI\UI\Core\Button.cs:114 
  at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00001] in .\Library\PackageCache\com.unity.ugui\Runtime\UGUI\EventSystem\ExecuteEvents.cs:57 
  at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x0006f] in .\Library\PackageCache\com.unity.ugui\Runtime\UGUI\EventSystem\ExecuteEvents.cs:272 
UnityEngine.DebugLogHandler:Internal_LogException_Injected(Exception, IntPtr)
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at .\Library\PackageCache\com.unity.ugui\Runtime\UGUI\EventSystem\ExecuteEvents.cs:276)
UnityEngine.InputSystem.UI.InputSystemUIInputModule:ProcessPointerButton(ButtonState&, PointerEventData) (at .\Library\PackageCache\com.unity.inputsystem\InputSystem\Plugins\UI\InputSystemUIInputModule.cs:617)
UnityEngine.InputSystem.UI.InputSystemUIInputModule:ProcessPointer(PointerModel&) (at .\Library\PackageCache\com.unity.inputsystem\InputSystem\Plugins\UI\InputSystemUIInputModule.cs:362)
UnityEngine.InputSystem.UI.InputSystemUIInputModule:Process() (at .\Library\PackageCache\com.unity.inputsystem\InputSystem\Plugins\UI\InputSystemUIInputModule.cs:2270)
UnityEngine.EventSystems.EventSystem:Update() (at .\Library\PackageCache\com.unity.ugui\Runtime\UGUI\EventSystem\EventSystem.cs:530)

(Filename: C:/build/output/unity/unity/Runtime/Export/Scripting/BindingsHelpers.cs Line: 62)
1 Like

I have the same exact issue and I have no idea how to fix it as of now. Will keep trying and will let know if I fix it myself.