- Home /
using iTween on multiple objects within a function.
Hey Guys. I'm a total noob, so this is probably going to be an easy answer.
I'm trying to write a function that moves 3 objects at once using iTween. I just don't know the proper way to pass in a gameObject into the parameters set out by iTween.
Usually it goes like this:
iTween.MoveTo(gameObject,{"z":0, "time": 0.5});
I just don't know how to substitute the word gameObject with one that I can specify.
Thanks for the help!
Answer by Berenger · Feb 29, 2012 at 05:44 PM
gameObject is the GameObject a component is attached to, and a component (your script is one) always have a gameObject. To move those three objects A, B and C, it depends what type they are (not really, but it's cleaner). If they are GameObjects, call
iTween.MoveTo(A,{"z":0, "time": 0.5});
iTween.MoveTo(B,{"z":0, "time": 0.5});
iTween.MoveTo(C,{"z":0, "time": 0.5});
if it's an other component, like Transform, call it with A.gameObject etc.