- Home /
How To Move GameObjects In Fixed Path?
I have two questions in one. Yes I know only one question per question asked but it's related to this. I'll be sure to not only accept who's ever answer I'm most satisfied with, but also give it a like. Anyways as you read in the title I want to know how can I move certain gameobjects in a fixed path to a certain position. For an example let's say a gameobject is off screen, well I would like to move it across the screen all the way to the end in a diagonal movement(straight up across the screen), then destroy it so it doesn't affect the performance or something.
Now the next question, how can I change the scale of a sprite gameobject from a script to a certain scale? It's like the first question only re-scaling it not moving it. Well sorry for the long paragraphs it was mostly just me typing nonsense. Anyways thanks for reading.
Answer by YoungDeveloper · Aug 21, 2014 at 11:23 AM
Use iTween: https://www.assetstore.unity3d.com/en/#!/content/84 It can do everything related to moving in certain paths.
What comes to your sprite scaling, it's not clear, if you want to scale go itself use transform.localScale http://docs.unity3d.com/ScriptReference/Transform-localScale.html
If you want to scale sprite itself use sprite.bounds http://docs.unity3d.com/ScriptReference/Sprite-bounds.html
I'll check it out, though I always have problems when using things from the asset store, but who knows maybe I can get something working this time. I just tried using localScale, it does not achieve my desired effect so far. It just changes the scale right off the bat, and not slowly changing it. I haven't used sprite bounds yet, I'll look into it.