Support => NGUI 3 Support => Topic started by: Seizon on March 06, 2014, 05:08:21 AM
Title: Re-sizing texture run-time, changes position drastically
Post by: Seizon on March 06, 2014, 05:08:21 AM
Hi! So, I got awesome help last time, so I thought I'd try again. :)
I'm re-sizing a UITexture with these two lines:
texture.width+= someValue;
texture.height+= someOtherValue;
Which works in the sense that it re-sizes it, as it should, but for some reason, running just one of these lines, will move the UITexture towards it's anchor point "average". So mine is anchored to the top and left side of the UIRoot, which moves it up an left. (Top and right would result in the texture moving up and right instead.) Why does it do this? Am I missing something? :)
Cheers!
Title: Re: Re-sizing texture run-time, changes position drastically
Post by: ArenMook on March 06, 2014, 11:09:24 AM
You should change the widget's pivot point to be top-left as well. Centered sprites should only be adjusted by values that can be divided by two, otherwise you end up with floating point offsets, which ultimately get rounded down when converted back to integer form.