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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值