Author Topic: Alignment Left + Resize Freely - Doesn't work?  (Read 2338 times)

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Alignment Left + Resize Freely - Doesn't work?
« on: March 11, 2014, 06:19:47 AM »
Hi,

as you can see in the screenshot, I have a little AI Debug display in my game. With older NGUI versions (v3.4.7?) it worked, but with newish Label -> Alignment: Left option it doesnt anymore.

It seems that when you chose Alignment: Left and Overflow: ResizeFreely the Label grows in all directions, instead of only to the bottom and right.

Or am I doing something wrong? I thought one was supposed to use Anchors now, but ResizeFreely disables the Anchors option on the Label. Hm, OK, makes sense ... but what now?
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Alignment Left + Resize Freely - Doesn't work?
« Reply #1 on: March 11, 2014, 04:13:54 PM »
Change the pivot of the label to be top-left. When you specify a center pivot, it will grow in all directions.

Alignment is only for printing.

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Alignment Left + Resize Freely - Doesn't work?
« Reply #2 on: March 13, 2014, 06:29:10 AM »
Oops, forgot about the pivot setting, thanks.

But ... that doesnt change the fact that I cant set Overflow -> Resize freely when I use an Anchor. I'd prefer using the Anchor on the parent UIPanel, but that option is greyed out.
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Alignment Left + Resize Freely - Doesn't work?
« Reply #3 on: March 14, 2014, 12:13:08 PM »
You can use resize freely.

1. Change pivot to top-left.
2. Use advanced anchoring, and set only top and left anchor. Leave bottom and right as null.

Bradamante3D

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 79
    • View Profile
Re: Alignment Left + Resize Freely - Doesn't work?
« Reply #4 on: March 14, 2014, 02:19:10 PM »
Well stuff like that works if the target GameObject containt a UILabel.

I had no luck with a UIGrid component. I can set the anchor of the UISprite (I want to use a sprite to provide a black background for a table) to Advanced*, but the top and right anchors remain at: Center + x. But in this case I need the UIGrid's right and top if I want the background to encapsulate the content, obviously.

I wonder that UIGrid doesn't work. WidgetContainer does and UIGrid inherits from it.
Is there a list of stuff that is officially supported by the anchor system?

* And I set the right and top anchors to null it doesn't even snap back to Unified ;)
#301224014, #301432336, #302399130

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Alignment Left + Resize Freely - Doesn't work?
« Reply #5 on: March 14, 2014, 04:00:19 PM »
UIGrid is just a component that arranges children. It's not a widget, and it has no rectangle. Widget Container is also not a widget. It's just a class that makes it possible to drag something as if it was a widget, making it easier to move in the scene view.

Unified = all 4 anchors equal to the same target. If any of the 4 anchors are not set, then it's Advanced, not Unified.