Author Topic: Anchor system with widget container  (Read 4161 times)

retroactive64

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Anchor system with widget container
« on: May 30, 2015, 01:59:10 PM »
Hi,

for the most part the anchor system works as expected, i have one small problem though:
i want to anchor a sprite to the bottom of a widget container which contains two labels.
i thought it would work as if i would set a label as target (which works) but its drop downs are set to "Target Center" and greyed out
and if i disable a label inside the container the sprite does not move accordingly.

I can see the extend of the widget container correctly updating (Editor view) but the anchor system does not work.

How can i set a container as anchor target?

NGUI Version: 3.7.4

thanks

retroactive64

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchor system with widget container
« Reply #1 on: June 01, 2015, 08:55:41 PM »
If you only see "target center" and the selection is grayed out, then you've anchored to a transform, not a widget. Widget container doesn't have dimensions. It's just a helper class that assumes in-editor dimensions of the content within it for easy dragging.

retroactive64

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Anchor system with widget container
« Reply #2 on: June 02, 2015, 04:20:10 AM »
thanks for your answer but which widget takes underlying widgets in the hierarchy into account (width/height rect) when being used as an anchor?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchor system with widget container
« Reply #3 on: June 07, 2015, 12:14:15 PM »
None. If you want that kind of behaviour, you should look at UIWrapContent. It's able to resize one widget to envelop the contents of a target object.