問題地址:Specifying a delegate for the value of onupdate in iTweenhtml
一、找到 void CallBackui
二、修改如下代碼:this
void CallBack(string callbackType){ if (tweenArguments.Contains(callbackType) && !tweenArguments.Contains("ischild")) { //establish target: GameObject target; if (tweenArguments.Contains(callbackType+"target")) { target=(GameObject)tweenArguments[callbackType+"target"]; }else{ target=gameObject; } //throw an error if a string wasn't passed for callback: if (tweenArguments[callbackType].GetType() == typeof(System.String)) { target.SendMessage((string)tweenArguments[callbackType],(object)tweenArguments[callbackType+"params"],SendMessageOptions.DontRequireReceiver); }else if (tweenArguments[callbackType] is Action) { ((Action)tweenArguments[callbackType]).Invoke(); }else if (tweenArguments[callbackType] is Action<object>) { ((Action<object>)tweenArguments[callbackType]).Invoke((object)tweenArguments[callbackType + "params"]); }else{ Debug.LogError("iTween Error: Callback method references must be passed as a String!"); Destroy (this); } } }
三、用法以下:spa
iTween.MoveTo(gameObject, iTween.Hash( "x", x, "y", y, "time", t, "easeType", iTween.EaseType.easeInCubic, "oncomplete", (Action)Landing)); void Landing() { // TODO }