Author Topic: TweenHeight - Widget width with real value not local  (Read 2866 times)

quaigon

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
TweenHeight - Widget width with real value not local
« on: July 24, 2014, 09:48:57 AM »
GameObjects:
UISprite with Size 662x632 and Anchors on Unified Left/Right/Bottom/Top 0

Target is the parent UIWidget with the same Size 662x632 and Achors on Unified Left 20 / Right -342 / Bottom 20 / Top -116. Target is the parent UIPanel, which is empty and a child of UI Root (FixedSize, 768)

On the UISprite is a TweenHeight (From 2 To 632) as component.


Problem:
On Editor-Play-Mode with ScreenSize 1024x768 there is all fine. The UISprite changes its height as soon as the Tween is playing. From 662x2 to 662x632.

On iPad4 (and other devices) there is the following problem: Before the Tween will be started, all values are right. In the moment, when the tween send the first value, the width jumps to 1324. So the UISprite goes from 1324x2 to 1324x632.

It seems that TweenHeight use the real resolution from the iPad 2048x1536 and double the local width of the UISprite.

Without TweenHeight all works fine.


Questions
So maybe there is a bug? And shouldn't send TweenHeight only the height value, not the whole localsize? Or its there something wrong with my thoughts and settings?


Temporary Solution
As a temporary solution i put the TweenHeight on a separate, empty UIWidget and read out the height value with an extra script and send it to the UISprite.

NGUI Version
3.6.8

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TweenHeight - Widget width with real value not local
« Reply #1 on: July 25, 2014, 01:47:40 AM »
All TweenHeight does is tweens the widget's height value from A to B. It doesn't know anything about anchors or screen size. The "from" value is the current height of the widget if you used TweenHeight.Begin, or the chosen value in inspector if you didn't. The "to" value is what you specified in inspector. Check the code for it, it's really short. Also note that TweenHeight doesn't touch the width at all. Anchors might, however -- especially if you've chosen a specific aspect ratio.