Author Topic: Dynamic fonts giant... I don't even know how to describe this  (Read 2192 times)

capitalj

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 88
    • View Profile


Ok, so this happens when I instantiate a dynamic font uilabel prefab and anchor it to a gameobject offscreen. This only appears in builds, not in the editor. So far I've tested only iOS and Mac builds. In the editor the labels work perfectly and anchor themselves to my object. In builds they are gigantic when instantiated....

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic fonts giant... I don't even know how to describe this
« Reply #1 on: May 09, 2014, 05:49:53 AM »
Use NGUITools.AddChild. Using Instantiate is bad mojo.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Dynamic fonts giant... I don't even know how to describe this
« Reply #2 on: May 09, 2014, 07:25:57 AM »
Because the UI is in a very small size, you instantiate it as globally 1,1,1 (or the size in the prefab), then parent it into the UI, which makes it huge. Check the local scale of it in the inspector.

The easy solution is to use AddChild, but if you're savy, you can look into what AddChild actually does, so you understand why it's doing what it's doing. ;)

capitalj

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Dynamic fonts giant... I don't even know how to describe this
« Reply #3 on: May 09, 2014, 01:16:23 PM »
Thanks Nicki and ArenMook. That was it exactly. I usually use AddChild for all ngui items but for some reason was trying to use an object pooling system for this one prefab... Must have been a leftover from the 3d text mesh i was using before.