Author Topic: Anchors resizing problem  (Read 1346 times)

littledrill

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Anchors resizing problem
« on: February 10, 2014, 01:57:39 PM »
Using NGUI 3.0.8 f7.

Dragging in a ready Control button from Wooden examples. Setting its anchor to Unified to the UI Root. SELECTING THE UIRoot, the Scene view says it size is 320x512.
Setting its values to:
Left to Targets Left + 0.
Right to Targets center - 86.
Bottom to Targets center + 43.
Top to Targets Top -77.

This gives the button a width of a third of the screen. Looks good in editor. If I resize the editor view, the button resizes like it should, keeping same ratio to the screen.

But when I go Fullscreen its not doing it correctly anymore. It's more than a third of the width, and very high. If I were to guess, it seems like it keeps the anchor at targets center -86 pixels, even though the screen is now bigger than in the editor.
Is this the intended behaviour?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchors resizing problem
« Reply #1 on: February 10, 2014, 05:34:05 PM »
First, please update to the latest version before reporting issues. That said, your anchor is set using absolute values only. I don't see you using any relative values, which means that your widget is always going to be the same size in pixels. So if it was 200x100 with 320x512 screen, it will still be 200x100 on a 1920x1080 screen.

If you want it to be using a percentage of the screen as you seem to be trying to do, then you need to use "Custom", not "Target's Left", "Target's Right", etc -- and set your own 0 to 1 value.

Consult the documentation page for anchors, or watch the anchoring system video for more details.

http://www.tasharen.com/forum/index.php?topic=7013.0

http://www.youtube.com/watch?v=P8JTTE0JBXQ