Author Topic: Noob Question Problem with anchors.  (Read 3522 times)

SamK

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Noob Question Problem with anchors.
« on: June 03, 2014, 02:47:52 PM »
HI everybody,
I have this UI.
I want to make it modular. I have set the anchors to unified. and set the Aspect Ratio to free.
In UI root i have set the scaling to fixedsizeonmobile and set the manual hieght to 768 The screen which I designed the UI for and made slices . but i want i to work on multiple screens like i have a device Xperia U its res is 854 * 480. the UI is totally scattered.
The ref screens are attached.
As you can see the opponent button is out of shape. I want it to be like the first attachment all the time no matter which screen.
I have tried advanced anchoring and set the achors left right to each other still didnt worked   :(.
Any idea where im going wrong or whats the solution. would be very thankfull if you reply quickly. Need to fix this asap. I know it can be fixed im doing something wrong maybe.

BTW im using
UNity 4.3 and NGUI 3.5.7

Thanks
Sam
« Last Edit: June 03, 2014, 02:53:44 PM by SamK »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Noob Question Problem with anchors.
« Reply #1 on: June 03, 2014, 04:49:18 PM »
Since the sprites are set to be Simple, they'll just be stretched when you resize them, which means the angle will not be preserved.

Try making a border on the sprite on left and right and set it to Sliced, then they should keep the same angle.

As for the anchor, make sure you're targeting the right thing. The opponent in the second image is targeting SettingMeny, is that right?

SamK

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Noob Question Problem with anchors.
« Reply #2 on: June 04, 2014, 07:37:16 AM »
Yes making them sliced sprite worked. I have also made other spirites to sliced as well now.
The anchoring issue is there. Now i have set all the achors to advanced
In frist Screen as you can see (opponents right is laps left) and (opponents left is Roots Center)
In Second Screen as you can see (opponents right is laps left) and (opponents left is Roots Left)
In third Screen as you can see (opponents right is laps left) and (opponents left is Roots Left) and now (laps left is set to Roots Left which was previously Roots Center or opponents Right same effect)
I dont want anyone to stretch I want all of them to strech equally.
Sound Opponents and Laps.
« Last Edit: June 04, 2014, 10:12:18 AM by SamK »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Noob Question Problem with anchors.
« Reply #3 on: June 05, 2014, 12:15:37 AM »
If you want them to stretch equally, then use relative anchoring. Instead of specifying "Left", "Right", "Center", etc, choose "Custom". Clear the absolute value, and choose a relative one instead for each anchor point. For example, to make a sprite always take 33% of the screen's width and be in the bottom-left corner, you'd choose left value of 0 and right of 0.333. Consult the documentation for more info: http://www.tasharen.com/forum/index.php?topic=7013