Author Topic: What is the correct approach to programatically scaling a UIRect?  (Read 1607 times)

Vesuvian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Hi all

I'm trying to figure out the correct approach to changing the scale of a UIRect at runtime.

In my experience, changing the scale of the GameObject does work, but I tend to see the scale changing again on the next frame.

Can anyone advise the correct way to scale a UIRect programatically?

Thanks,
Ves

rain

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 79
    • View Profile
Re: What is the correct approach to programatically scaling a UIRect?
« Reply #1 on: February 27, 2014, 12:34:18 PM »
What are you trying to achieve by "scaling a UIRect"? As far as i know, UIRect only has anchor points.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: What is the correct approach to programatically scaling a UIRect?
« Reply #2 on: February 27, 2014, 04:55:46 PM »
Scaling an NGUI object is same as scaling any other object. NGUI doesn't use transform scale, leaving it at (1, 1, 1). If you scale something, it will be smaller, but make sure you don't want to simply adjust its size. Adjusting the size is a matter of setting width and height.