Author Topic: how to match clipping panel x size with actual screen resolution  (Read 4876 times)

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Hello,
I have a UIPanel with clipping that is set to be as width as the screen.
The problem is that if screen resolution changes, the clipping size doesn't not match screen with anymore.
How to dynamically change the clipping size in order to always match screen width?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: how to match clipping panel x size with actual screen resolution
« Reply #1 on: January 13, 2015, 03:17:08 PM »
Just anchor it.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: how to match clipping panel x size with actual screen resolution
« Reply #2 on: January 14, 2015, 02:18:48 PM »
which anchor do you mean?
now the UIPanel is in the center anchor and the x size of the clipping panel is set to a fixed amount (1200 for WVGA Landscape (800x480)) but this value is not ok with the other resolutions (for example with WSVGA Landscape (1024X600) the right value seems to be 1225).
What are we doing wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: how to match clipping panel x size with actual screen resolution
« Reply #3 on: January 14, 2015, 10:09:11 PM »
I mean... just anchor it. Enable anchoring on the panel like any widget. Select the panel, note the "Anchors" section. All 4 sides can be anchored, same as any widget. I am not sure I understand where your difficulty lies.

newlife

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: how to match clipping panel x size with actual screen resolution
« Reply #4 on: January 18, 2015, 07:57:08 PM »
Sorry ArenMook, my fault. I was using an old version of NGUI (prior to 3.0). I updated NGUI and i solved the issue with anchors (altough it hasn't been straightforward, I had to set the execute type of Grid anchors to onEnable instead of onUnpdate in order to make everything works).