Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Sahkan on July 08, 2014, 05:27:00 AM

Title: Is there a way to anchor sprites and make them move with script ?
Post by: Sahkan on July 08, 2014, 05:27:00 AM
There is a game i'm working on that need to fit 4:3 and 16:9 screens, and some of the sprites has to move in the game, but when i anchor them, they wont move, is there any way to bypass that ?
Title: Re: Is there a way to anchor sprites and make them move with script ?
Post by: 505083367 on July 08, 2014, 05:56:13 AM
your version?
i dont know if you have option in anchors like "Execute", change it to OnEnable;
Title: Re: Is there a way to anchor sprites and make them move with script ?
Post by: Sahkan on July 08, 2014, 06:30:28 AM
3.5.3
Title: Re: Is there a way to anchor sprites and make them move with script ?
Post by: ArenMook on July 08, 2014, 12:23:23 PM
If you anchor something, then how do you plan on moving it? It's anchored. By definition it will move only if whatever it's anchored to will move.

Some scripts in NGUI are meant to work around this, such as TweenPosition -- it will adjust the anchor' offset for you. You can also move it via code -- NGUIMath.MoveWidget.
Title: Re: Is there a way to anchor sprites and make them move with script ?
Post by: Sahkan on July 08, 2014, 10:33:49 PM
kk Thanks.