- Home /
Using iTween to chain multiple paths together
I'm using iTween's MoveTo function, and it's working great. However, I'd like to have iTween do a series of functions, and when one function finishes, the next one begins (e.g. start at A, iTween.moveTo B, when B is reached, iTween.moveTo C, when C is reached, iTween.moveTo D).
I'm familiar with the onComplete parameter, and I'm pretty sure the solution will involve that, but I'm having difficulty wrapping my head around it. Can anyone push me in the right direction?
Well, I figured out why I was having so much difficulty with it. I was firing my iTween function within a class, and calling a function that was also in that class. Apparently, that doesn't work. Rethinking my strategy.
Answer by Screenhog · Aug 31, 2012 at 06:05 PM
OK, here's the answer. To make a function fire at the end of an iTween, use "oncomplete" in the hashtable. If your function in oncomplete requires a variable, put it in "oncompleteparams". If your function requires multiple parameters, use the technique found here: http://answers.unity3d.com/questions/161782/multiple-parameters-through-itween.html
Fortunately, I was able to rewrite my code so that multiple parameters were not needed, but now I know where to turn if that is the case. Hope this helps someone.
Your answer
![](https://koobas.hobune.stream/wayback/20220613080432im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple iTween MoveTo's 1 Answer
iTween - look for new path, move to or reverse at end? 0 Answers
Go back to first node (itween + moveto) 2 Answers
Stacking iTween.MoveTo calls 1 Answer
iTween callback functions not firing 1 Answer