My script don't work correctly... ArgumentException: method arguments are incompatible *Animation Script*
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 :0) System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at :0) UnityEngine.Events.InvokableCall..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at :0) UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at :0) UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at :0) UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at :0) UnityEngine.Events.UnityEventBase.PrepareInvoke () (at :0) UnityEngine.Events.UnityEvent.Invoke () (at :0) UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2021.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:70) UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2021.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:114) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2021.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:57) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2021.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:272) UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2021.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:501)
I have this script:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class MenuManager : MonoBehaviour { bool theme = false;
public GameObject logo;
private void Start()
{
}
public void OnThemeClicked()
{
if (theme)
{
logo.GetComponent<Animator>().Play("LogoToDark");
theme = false;
}
else
{
logo.GetComponent<Animator>().Play("LogoToLight");
theme = true;
}
}
}
But when i clicked on Button i have error upper... What happend?
Your answer
![](https://koobas.hobune.stream/wayback/20220613023614im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
WTF does this error mean 1 Answer
"The associated script cannot be loaded" 0 Answers
OVR Walking Animation trigger. 0 Answers
No Loop Time Options in Animation Inspector 1 Answer
The name animator does not exist in the current context... Help? 1 Answer