event with a parameter of "none" gets converted anyway?

I’m getting this from that
6692614--767824--upload_2021-1-5_17-52-10.png
which means that None gets converted to LevelPin, I expect none to = null and since LevelPin is a class there should be no problem.
A bug in the button component? How events work?

ArgumentException: Object of type 'UnityEngine.Object' cannot be converted to type 'LevelPin'.
System.RuntimeType.CheckValue (System.Object value, System.Reflection.Binder binder, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEngine.Events.PersistentCall.GetObjectCall (UnityEngine.Object target, System.Reflection.MethodInfo method, UnityEngine.Events.ArgumentCache arguments) (at <bad59441812943c7b8d5a5ba85795810>:0)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at <bad59441812943c7b8d5a5ba85795810>:0)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at <bad59441812943c7b8d5a5ba85795810>:0)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at <bad59441812943c7b8d5a5ba85795810>:0)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at <bad59441812943c7b8d5a5ba85795810>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <bad59441812943c7b8d5a5ba85795810>:0)
UnityEngine.UI.Button.Press () (at Z:/___devTools/Unity/2020.1.17f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Z:/___devTools/Unity/2020.1.17f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Z:/___devTools/Unity/2020.1.17f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Z:/___devTools/Unity/2020.1.17f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at Z:/___devTools/Unity/2020.1.17f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)

Since the entry is there, Unity expects a value, just press the “-” button and remove that OnClick entry.

Add an override to MCEventLevelPin.Raise that takes zero arguments and use that override instead.

1 Like