- Home /
Force iTween to complete
Hello there, I need to force an iTween to complete suddenly and trig oncomplete event. But I can't find how to do that. The iTween.Stop() can only stop the tween in midway. This is expected to be used when skipping the dialogs and so on. Is there someway to do this? Thanks!
Answer by Philipp · Mar 06, 2013 at 11:57 AM
There's nothing out of the box, AFAIK. However iTween works by temporarily adding an iTween component per tween to the GameObject, and these components have publicly accessible members, with which you can change the duration of the tween... If you don't mind that it's a bit of a hack, you could do something like this:
iTween[] tweens = GetComponents<iTween>();
foreach (iTween tween in tweens) {
tween.time = 0;
tween.SendMessage("Update");
}
wow this works fine~ thanks a lot. I do not know why iTween does not have this function, I think many devs need this function too. I'm going to change iTween's Code and add a function "iTween.Stop(bool forceEnd)".