Author Topic: NGUI UISprite problem  (Read 2836 times)

yantbom

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
NGUI UISprite problem
« on: February 24, 2015, 04:43:12 AM »
Hi, guys !
Here is a problem, need your help. I create UISprite somewhere in UIRoot hierarchy. Then I need to change its sizes at runtime through code (see attached image). For now i look through UISprite documentation and found no possible way to do that, can u plz help me ?

yantbom

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: NGUI UISprite problem
« Reply #1 on: February 24, 2015, 09:17:53 AM »
Well, apparantly, when dynamically creating sprites u can change its     .width     property only in next frames, not instantly. It solves the problem.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI UISprite problem
« Reply #2 on: February 24, 2015, 11:44:41 AM »
You shouldn't be trying to change the width of something that's anchored on both left and right. Anchor is what sets your width. If you want to adjust the width, anchor on only one side.