So I am using the Unity 4.6 UI Buttons when this error came up:
ArgumentException: method return type is incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Delegate.cs:190)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Delegate.cs:276)
UnityEngine.Events.InvokableCall…ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:98)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:355)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:517)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:673)
UnityEngine.Events.UnityEventBase.Invoke (System.Object parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:709)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/guisystem/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/guisystem/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/guisystem/EventSystem/ExecuteEvents.cs:52)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/guisystem/EventSystem/ExecuteEvents.cs:269)
UnityEngine.EventSystems.EventSystem:Update()
Here’s my Script:
#pragma strict
var login : GameObject;
var create : GameObject;
var f : float;
var i : int = 0;
private var swipe : boolean = true;
function Update ()
{
if (i > 0)
{
swipe = true;
var b : GameObject = gameObject.FindGameObjectWithTag("B2");
b.GetComponent(UI.Button).interactable = true;
}
if (i == 0)
{
var b2 : GameObject = gameObject.FindGameObjectWithTag("B2");
b2.GetComponent(UI.Button).interactable = false;
}
if (i <= -1)
{
swipe = false;
}
}
function LoginToForgot ()
{
iTween.MoveTo(login,Vector3(-15,0,0),1);
iTween.MoveTo(create,Vector3(0,0,0),1);
}
function ForgotToLogin ()
{
iTween.MoveTo(login,Vector3(0,0,0),1);
iTween.MoveTo(create,Vector3(15,0,0),1);
}
function SkateparksRight ()
{
if (swipe == true)
{
i++;
swipe = false;
var alga : GameObject = gameObject.FindGameObjectWithTag("AlgaTest");
var aura : GameObject = gameObject.FindGameObjectWithTag("AuraTest");
var cbp : GameObject = gameObject.FindGameObjectWithTag("CBPTest");
iTween.MoveTo(alga,Vector3(alga.transform.position.x - f,alga.transform.position.y,alga.transform.position.z),1);
iTween.MoveTo(aura,Vector3(aura.transform.position.x - f,aura.transform.position.y,aura.transform.position.z),1);
iTween.MoveTo(cbp,Vector3(cbp.transform.position.x - f,cbp.transform.position.y,cbp.transform.position.z),1);
yield WaitForSeconds (1);
swipe = true;
}
}
function SkateparksLeft ()
{
if (swipe == true)
{
i--;
swipe = false;
var alga : GameObject = gameObject.FindGameObjectWithTag("AlgaTest");
var aura : GameObject = gameObject.FindGameObjectWithTag("AuraTest");
var cbp : GameObject = gameObject.FindGameObjectWithTag("CBPTest");
iTween.MoveTo(alga,Vector3(alga.transform.position.x + f,alga.transform.position.y,alga.transform.position.z),1);
iTween.MoveTo(aura,Vector3(aura.transform.position.x + f,aura.transform.position.y,aura.transform.position.z),1);
iTween.MoveTo(cbp,Vector3(cbp.transform.position.x + f,cbp.transform.position.y,cbp.transform.position.z),1);
yield WaitForSeconds (1);
swipe = true;
}
}
function AfterSubmission ()
{
var logIn : GameObject = gameObject.FindGameObjectWithTag("LogIn");
var createAccount : GameObject = gameObject.FindGameObjectWithTag("CreateAccount");
var skateparks : GameObject = gameObject.FindGameObjectWithTag("Skateparks");
iTween.MoveTo(logIn,Vector3(0,20,0),1);
iTween.MoveTo(createAccount,Vector3(15,20,0),1);
iTween.MoveTo(skateparks,Vector3(0,0.4,-0.01),1);
}
function SignOut ()
{
var logIn : GameObject = gameObject.FindGameObjectWithTag("LogIn");
var createAccount : GameObject = gameObject.FindGameObjectWithTag("CreateAccount");
var skateparks : GameObject = gameObject.FindGameObjectWithTag("Skateparks");
iTween.MoveTo(logIn,Vector3(0,0,0),1);
iTween.MoveTo(createAccount,Vector3(15,0,0),1);
iTween.MoveTo(skateparks,Vector3(0,-20,-0.01),1);
}
Thanks!