Author Topic: Padding at left  (Read 9061 times)

xito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Padding at left
« on: May 31, 2013, 06:20:42 AM »
Hello!
I try to put personalized fonts in my game with NGUI, I use this type of font (Ms Trebuchet 32) made with Glyph Designer.

How You can see, the pivot is centered but the fonts are moved to right like I put a padding. Do you know where can be the error?
With the same font, when I use this in editor, all is ok, but when I use in mobile devices, this font flickers.

I attach the fnt, png files and a capture of inspector with atlas and font.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Padding at left
« Reply #1 on: May 31, 2013, 02:01:27 PM »
May be a defective font, or may be related to export properties on the glyph designer. I advise using BMFont, or just go with the dynamic font feature.

xito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Padding at left
« Reply #2 on: June 03, 2013, 05:02:20 AM »
Hello again!
Now, I'm using BMFont and my problem now is labels shake when they update and try to replace with anchors. We use UIAnchors.

I put a video like attachment to show you my error.

And these are values that my label oscilates : x: 183.9882 // y: 137.9912  -> x:183.5 //y:137.5
And other : x: 61.99603//y: -85.98905 ->  x: 62 //y: -85.5



Thanks.
« Last Edit: June 03, 2013, 07:07:15 AM by xito »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Padding at left
« Reply #3 on: June 03, 2013, 09:37:13 AM »
Change the pivot point to top-left, and make sure you don't have anchor parented to another anchor if both use camera dimensions.

xito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Padding at left
« Reply #4 on: June 03, 2013, 10:52:07 AM »
Sorry, but my fonts fail yet :(. I try that my label hasn't widget container and put his pivot point to top-left, but I can't fix the error.

Can you explain me better "don't have anchor parented to another anchor if both use camera dimensions"?


Thanks.
 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Padding at left
« Reply #5 on: June 03, 2013, 09:33:46 PM »
I meant this would be wrong:

UIRoot
- Camera
-- Anchor 1
--- Panel
---- Anchor 2

xito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Padding at left
« Reply #6 on: June 04, 2013, 03:25:21 AM »
Ok, Thanks Aren.
If we have lot of GUI made based on anchor parenting :'(, will it work properly after we move to 2.6.2 (i.e. anchors destroying themselves at runtime)?
Do you think the way anchors work is going to change anytime soon to support parenting?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Padding at left
« Reply #7 on: June 04, 2013, 08:38:04 PM »
I don't foresee future changes to the anchoring, and the 2.6.2 addition will indeed prevent the extra movement, but the problem is still in the nested anchors. Each anchor moves itself independently, so the child's movement overwrites the parent. If Unity updates the child first, and then the parent, then what you end up seeing is child sets itself properly, then parent messes it up.

BlueByLiquid

  • Guest
Re: Padding at left
« Reply #8 on: June 04, 2013, 09:00:20 PM »
I meant this would be wrong:

UIRoot
- Camera
-- Anchor 1
--- Panel
---- Anchor 2

I am having a problem with an example almost exactly like the above. I have a UITable as a chile of "Anchor 2" and I need it to show up on the top left of the Panel. I thought you could set the second anchor to use the Panel and not the camera but that doesn't work as their is no difference between Centered and Top Left if I do that. If I set it to the camera I get a similar wobbling effect as described. So How would you then place something at the top left of the panel without the anchor?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Padding at left
« Reply #9 on: June 04, 2013, 09:12:04 PM »
I wouldn't place it at the "top left of the panel" as panels have no size. A panel is just a component that collects widgets together and batches them for drawing.

Assuming that you meant "top left of the screen", I would structure my UI so that I would only have one anchor in the hierarchy like so:

UIRoot
- Camera
-- Panel
--- Anchor 1
--- Anchor 2

BlueByLiquid

  • Guest
Re: Padding at left
« Reply #10 on: June 04, 2013, 09:53:14 PM »
I wouldn't place it at the "top left of the panel" as panels have no size. A panel is just a component that collects widgets together and batches them for drawing.

Assuming that you meant "top left of the screen", I would structure my UI so that I would only have one anchor in the hierarchy like so:

I guess I was hoping to do that so I could move the panel and everything below it would be offset as well treating it more as a typical group or layer I guess with a relative size. I think my confusion is the next issue listed below:

I thought panels had sizes because the scene will display a hot pink rectangle when I select to do a hard clip. The clips is always centered and this is very confusing and seems wrong and different from everything else which works off the position and a width (I this was also another source of confusion where I thought anchors were being positioned twice.). For example If I have:

UIRoot
- Camera
---Anchor (set to top left)
----Panel (at pos 0, 0)
-----Table (at pos 0, 0)

It chooses a size based on the Table to clip but it is centered at the top left of the window clipping all but the top left of my screen. I realize some people might want the option to center it but can you add the ability to have it work with the size starting at the panels position like most components please?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Padding at left
« Reply #11 on: June 06, 2013, 08:50:42 AM »
If it's any consolation, I'm changing this in the upcoming UI system. :)

BlueByLiquid

  • Guest
Re: Padding at left
« Reply #12 on: June 06, 2013, 10:33:18 AM »
If it's any consolation, I'm changing this in the upcoming UI system. :)

Thanks for the reply.

Which part are you changing? The way clipping works? How so?

Also can I manually set the clipping area programatically? As it is I can't use the top left anchor if I want to clip my table because it basing the clip centered on the top left of the screen.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Padding at left
« Reply #13 on: June 07, 2013, 08:14:53 PM »
I can't talk about specifics. But clipping is one of the things that's going to be handled differently and in a more intuitive manner.

BlueByLiquid

  • Guest
Re: Padding at left
« Reply #14 on: June 07, 2013, 08:38:42 PM »
Thanks. How would I manually set the clipping area via code in the current system?