Author Topic: Label issue  (Read 2330 times)

yuyaokada

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Label issue
« on: June 06, 2014, 05:30:33 AM »
How can I change text size without changing transform.localScale?

Rajken

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 12
    • View Profile
Re: Label issue
« Reply #1 on: June 06, 2014, 06:14:38 AM »
You will need to get the UILabel component and then set the fontSize if you want to do it from the code
else you can set it in the editor after you have selected a font to use for that label.

yuyaokada

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Label issue
« Reply #2 on: June 06, 2014, 06:28:14 AM »
I wrote following code but I got an error " 'fontSize' is not a member of 'UILabel' ".

GameObject obj;
obj.GetComponent<UILabel>().fontSize = 0;

Caio.Lib

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 26
    • View Profile
Re: Label issue
« Reply #3 on: June 06, 2014, 10:20:51 AM »
yuyaokada, which is version of NGUI are you using?
This code works for me:

  1. gameObject.GetComponent<UILabel>().fontSize = 0;