Author Topic: Is there a way to anchor sprites and make them move with script ?  (Read 5131 times)

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
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 ?

505083367

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Is there a way to anchor sprites and make them move with script ?
« Reply #1 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;

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: Is there a way to anchor sprites and make them move with script ?
« Reply #2 on: July 08, 2014, 06:30:28 AM »
3.5.3

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Is there a way to anchor sprites and make them move with script ?
« Reply #3 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.

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: Is there a way to anchor sprites and make them move with script ?
« Reply #4 on: July 08, 2014, 10:33:49 PM »
kk Thanks.