Author Topic: GameObject to UIFont?  (Read 1688 times)

Nightreaver

  • Guest
GameObject to UIFont?
« on: January 14, 2013, 03:35:10 PM »
Sorry if this was discussed here already, but i haven't found anything.

I want to do a coversion from (Game)Object to UIFont

Solution:
  1.  
  2. UIFont realFont = (font.Value as GameObject).GetComponent<UIFont>();
  3.  
  4. UILabel lbl = NGUITools.AddWidget<UILabel>(go);
  5. lbl.font = realFont;   
  6. lbl.text = contentText.Value;
  7. lbl.color = textColor.Value;
  8. lbl.MakePixelPerfect();
  9.  

After two days i found a solution! Yay..

Thanks anyway for listening  ;D
« Last Edit: January 14, 2013, 04:13:12 PM by Nightreaver »