Author Topic: UILabel overflowing from Panel  (Read 5876 times)

selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
UILabel overflowing from Panel
« on: March 01, 2013, 03:47:36 PM »
Hi there guys,

I have been using NGUI for a while and its really increased my productivity. I have a problem that only manifests itself when running on mobile devices.

I have a "mini panel" inside the main panel (as described in the clip-able scroll view example) and a UILabel inside it (child to the panel). I want the UI label to grow as new text is entered and give me an effect similar to a DOS terminal, eg new text comes in at the bottom, pushes the old text up, that eventually disappears off the top of the panel. I have set it up using pivots etc and it works in the editor and the game view fine (see picture:  www.gameplayportal.com/Dev/editor.png).

When I compile and run on the device I get a "residue" of the text outside of its panel. (see picture: www.gameplayportal.com/Dev/device.jpg)

I could do some Z layer masking and rearrange the backgrounds, but there must be a simple solution to this surely?

Any ideas?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UILabel overflowing from Panel
« Reply #1 on: March 01, 2013, 04:56:56 PM »
I would recommend setting up a number of labels that you switch manually instead. This is the way many big games do it like Starcraft with their error messages.

When a new message comes in, you push it to the next label like a queue and you keep track of how it should fade out.

Obviously, you couldn't scroll back in the messages then, but it doesn't look like you want to do that anyway.


selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: UILabel overflowing from Panel
« Reply #2 on: March 01, 2013, 05:01:11 PM »
Thanks for the suggestion Nicki

I guess an even easier way would be to keep an array list of lines and only print out the last X additions, I could then make a scroll list too.

Just surprised I cannot do this out of the box, seems simple enough functionality

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel overflowing from Panel
« Reply #3 on: March 01, 2013, 06:12:04 PM »
The shader you used for clipping doesn't seem to play well with your device. Try using another clipping method.

selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: UILabel overflowing from Panel
« Reply #4 on: March 05, 2013, 09:41:40 AM »
I tried soft / hard / none etc but no difference, anyway, I have solved the issue by coding around it, thanks for the time!