Author Topic: Set panel size  (Read 3001 times)

flavoredCoffee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 15
    • View Profile
    • CWGTech Unity & Programming blog
Set panel size
« on: October 14, 2013, 03:17:31 PM »
Hi,

I'm still using NGUI 2.x (legacy reasons) -- I'm trying to make my app adjust the layout for iPad portrait & landscape.

I've designed & created all my UI with the portrait display as default, and everything works as I want.  When the iPad is flipped to landscape, my plan is to take my UI panels and reposition them to the right of the game area (I take the gameplay camera and adjust it so it's on the left of the screen).

How do I tell an NGUI panel that it's limited in width -- right now they fill the screen.

Thanks,

FC.

macy

  • TNP Alpha
  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 8
    • View Profile
Re: Set panel size
« Reply #1 on: October 15, 2013, 06:26:09 PM »
UIAnchor makes elements align to different sides of the screen.
You can try to add this to your elements to make it move to the right.

There are examples in the downloaded packages.

flavoredCoffee

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 15
    • View Profile
    • CWGTech Unity & Programming blog
Re: Set panel size
« Reply #2 on: October 17, 2013, 01:28:04 PM »
That doesn't have the result I'm looking for.

I ended up re-parenting the elements to a couple of empty game objects and then reposition those elements through code.  Not as elegant, but seems to work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Set panel size
« Reply #3 on: October 18, 2013, 06:07:38 PM »
UIStretch can stretch panels in NGUI 3.0.2, but since you're using an older version... all I can suggest is do your own logic, or adapt the code from the latest version.