ArgumentException: method arguments are incompatible

Hello everyone!

I have 2 main problems regarding my game I would like to ask for your help on.

  1. There are several objects in my game that are clickable and a panel should be popping up upon clicking on them. For that, I have a popup system, which was created as a prefab, I duplicated it couple more times as needed and made each of it as a child of the actual object. I tried it in game mode, it worked like a charm, but when the pop up appeared, a few errors showed up with it at the console panel.

The errors are the following:

  1. error:
ArgumentException: method arguments are incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.Events.InvokableCall`1[T1]..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.CachedInvokableCall`1[T]..ctor (UnityEngine.Object target, System.Reflection.MethodInfo theFunction, System.Boolean argument) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.EventSystems.EventTrigger.Execute (UnityEngine.EventSystems.EventTriggerType id, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventTrigger.cs:216)
UnityEngine.EventSystems.EventTrigger.OnPointerEnter (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventTrigger.cs:225)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerEnterHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:22)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:262)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:385)
  1. error:
ArgumentException: method arguments are incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.Events.InvokableCall`1[T1]..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.CachedInvokableCall`1[T]..ctor (UnityEngine.Object target, System.Reflection.MethodInfo theFunction, System.Boolean argument) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.EventSystems.EventTrigger.Execute (UnityEngine.EventSystems.EventTriggerType id, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventTrigger.cs:216)
UnityEngine.EventSystems.EventTrigger.OnPointerExit (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventTrigger.cs:233)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerExitHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:29)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:262)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:385)

I guess it is about the arguments regarding the button. How can I change it to eliminate the error?

  1. My second main problem is with the cursor

When I’m in game mode I can’t click on anything. For that, I have to press esc to make the mouse appear, but it ruins the game experience. Is there a way to make the default little ‘crosshair’ in the center to also work as a cursor and to be able to click with it on interactive objects?

Thank you in advance for your help, it would be a lifesaver if these issues could be resolved!

ArgumentException: method arguments are incompatible - can you post your method?Looks like you call it with wrong arguments but that cant be seen from code you posted.

Thank you for your reply. It turned out that I had to delete every event trigger in the object, those were the ones that caused the error. I appreciate the help tho!