Author Topic: Text appearing outside of UILabel bounds  (Read 6167 times)

ThomasIndustry

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Text appearing outside of UILabel bounds
« on: April 16, 2015, 11:01:46 AM »
I am creating a series of UIlabels dynamically using the NGUITools.AddChild<UILabel>(this.gameObject) function, but sometimes (Randomly about 20% of the time) the text shows up outside of the bounds area. If I manually disable the game object and then turn them back on, it corrects it's self, but this is not a very eloquent solution. Does anyone have an idea of what might be causing this?
They are under a panel with soft clipping and have their pivot set to left.


Dean

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Text appearing outside of UILabel bounds
« Reply #1 on: April 16, 2015, 01:04:41 PM »
Try using NGUITools.MarkParentAsChanged(gameObject); after all changes

ThomasIndustry

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Text appearing outside of UILabel bounds
« Reply #2 on: April 16, 2015, 03:20:33 PM »
I have tried that  :-\ and also tried levelName.MarkAsChanged() and levelName.SetDirty()

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Text appearing outside of UILabel bounds
« Reply #3 on: April 18, 2015, 12:42:07 PM »
Make sure to set the text last, after the position/width/height have been set, but that's all I can suggest without having more details.