Author Topic: Label Resizing on Mobile incorrectly  (Read 11620 times)

ricky

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 15
    • View Profile
Label Resizing on Mobile incorrectly
« on: July 15, 2014, 01:54:20 PM »
I have a label at top of screen, simply anchored to top of screen, it fills entire screen for story telling except for the bottom 10% of the screen. EVERYTHING works as expected, using Stretch (which I know is deprecated), but is only solution I could find, in "Editor Play mode, it works".

When pushed to mobile devices, the label is stretched beyond width of the screen in portrait mode, cutting off 10% on either side.

I have used anchors but they are completely 100% stationary.  Is there anything I'm missing here?  This is a screenshot of the desired result that works fine in editor, but published content just doesn't react the same.

Portrait Mode
http://image.com/dYXj6tW

Landscape Mode
http://imgur.com/2Ssa4oK

What is the proper solution to have a simple Label at top of screen to fill width and 90% of height that stretches in either landscape or portrait mode with 3.6+?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label Resizing on Mobile incorrectly
« Reply #1 on: July 15, 2014, 11:26:18 PM »
What do you mean by 100% stationary? The layout system is powerful and can achieve a lot more than using UIAnchor / UIStretch. For what you're doing, simply resize the label to be full screen size, then turn on Unified anchoring. It will automatically choose the sides it's closest to, which should be Left to Left, Top to Top, Right to Right, and Bottom to Bottom.

ricky

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Label Resizing on Mobile incorrectly
« Reply #2 on: July 16, 2014, 02:08:54 PM »
the problem is, the label is a child of AnchorTop, which has an anchor for the top of the screen.  If I set the label to advanced anchor type, you cannot change what it is a target of, you only have the option for "Target's Center", which doesn't work.

I tried creating a transparent sprite object that resizes automatically, then, instead of using anchor, the target is now the sprite.

The problem is, now the sprite has a problem of connecting properly.

So, now I try to add UIStretch to the transparent sprite, then anchor the label to the sprite so I can actually select the offset from top,bottom, left, right, but the underlying sprite is still offscreen and I get the same problem as mentioned.

ricky

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Label Resizing on Mobile incorrectly
« Reply #3 on: July 16, 2014, 02:15:12 PM »
To anchor an object to all 4 sides of the screen, what is the Target supposed to be?  I tried Camera, which gives offset from screen, but it doesn't work on play at all, only in editor.  Putting any empty Anchor object, limits me to offset from the center of that object only.

ricky

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Label Resizing on Mobile incorrectly
« Reply #4 on: July 16, 2014, 05:19:10 PM »
Ok, so for whatever reason, after retrying the Camera gameobject as the anchor transform, it's now working.  I can deduct from the edges of the screen instead of only from the center.  Before, that option was grayed out so I could not adjust or change it from Center to the appropriate (LEFT, RIGHT, BOTTOM, TOP) anchor.

Thanks!

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Label Resizing on Mobile incorrectly
« Reply #5 on: July 16, 2014, 06:08:39 PM »
If it falls back to a Panel as target ( instead of a widget ) then the full screen size is used as the size. It should "just work". ;)