Itween Stop

Itween stop .

Question:

Console-Error:

ArgumentOutOfRangeException: startIndex + length > this.length
Parameter name: length
System.String.Substring (Int32 startIndex, Int32 length) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/String.cs:356)
iTween.Stop (UnityEngine.GameObject target, System.String type) (at F:/FD/Projects/RMBAncientMoney/Dev/AncientMoney/Assets/iTween/iTween.cs:6430)
HutongGames.PlayMaker.Actions.iTweenFsmAction.OnExitiTween(HutongGames.PlayMaker.FsmOwnerDefault anOwner) (at F:/FD/Projects/RMBAncientMoney/Dev/AncientMoney/Assets/PlayMaker/Actions/iTween/iTweenFsmAction.cs:66)
HutongGames.PlayMaker.Actions.iTweenRotateBy.OnExit ()(at F:/FD/Projects/RMBAncientMoney/Dev/AncientMoney/Assets/PlayMaker/Actions/iTween/iTweenRotateBy.cs:53)
HutongGames.PlayMaker.FsmState.OnExit ()
HutongGames.PlayMaker.Fsm.ExitState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.Update ()
PlayMakerFSM.Update ()

Action (Itween rotate by),Stop On Exit is checked and the Game Object is disabled .It exists mistake when switching state from Rotating to End.


Solution:

Uncheck the Stop On Exit in the action of "Itween Rotate By" and set Id.In state of End Add action of "ITween Stop " and set id that is same as before.


Conclusion:

"Itween Rotate By "script --

[Tooltip("iTween ID. If set you can use iTween Stop action to stop it by its id.")]
public FsmString id;

"Itween.cs":

public static void Stop(GameObject target, string type){
Component[] tweens = target.GetComponents(typeof(iTween));
foreach (iTween item in tweens){
string targetType = item.type+item.method;//"targetType="",Type=rotate
targetType=targetType.Substring(0,type.Length);//startIndex + length > this.length
if(targetType.ToLower() == type.ToLower()){
item.Dispose();
}
}
}

1.when I set id to the itween, stop it by it.

2.The Target Game Object is disabled and there is no id .just stop on exit,The itween attached on the game object doesn't have id  and other value ,So the itween stop return none value.finally the error is rangeException


3.Enabled Behaviours are Updated, disabled Behaviours are not.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章