Author Topic: how to anchor buttons to corners of screen  (Read 4757 times)

frog

  • Guest
how to anchor buttons to corners of screen
« on: August 22, 2012, 04:01:08 AM »
how do you anchor buttons to corners of screen?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: how to anchor buttons to corners of screen
« Reply #1 on: August 22, 2012, 05:17:37 AM »
Look into UIAnchor.cs. Set the widget-pivot to the opposite of the UIAnchor-pivot and there you go.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: how to anchor buttons to corners of screen
« Reply #2 on: August 22, 2012, 05:19:58 AM »
I think what you want is described here :
http://www.tasharen.com/?page_id=418

PhilipC

  • Guest
Re: how to anchor buttons to corners of screen
« Reply #3 on: August 22, 2012, 10:08:13 AM »
Correct UIAnchor is what you need. It has options like, TopLeft, TopRight, BottomLeft, BottomRight, which would be the corners.

bitomule

  • Guest
Re: how to anchor buttons to corners of screen
« Reply #4 on: October 03, 2012, 01:40:57 PM »
Hi!

I'm having a similar problem, but I'm already using UIAnchor. My problem is, what happens if aspect ratio is different. Let me explain myself:

- I place a button using UIAnchor to the top left, anchor set to top left.
- It works perfect inside editor, I can change the window size and it's at the right position.
- But, on iPhone5 button is not top aligned, it just goes out of screen.

How can I make it work?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: how to anchor buttons to corners of screen
« Reply #5 on: October 03, 2012, 07:58:54 PM »
Why would it? Top-left is top-left, regardless of the aspect ratio. Try building the first example for your device.

yuewah

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 180
    • View Profile
Re: how to anchor buttons to corners of screen
« Reply #6 on: October 04, 2012, 08:33:36 AM »
@bitomule, what is NGUI and Unity version ?