c# - How to change Font type in Unity? -


how program can change font type to: coalition or arial...

here current code...

using unityengine; using system.collections;  public class invslothandler : monobehaviour {      private int excess = 1;     uilabel lbl;      void start() {          gameobject label = new gameobject();         lbl = label.addcomponent<uilabel>();          label.transform.name = "#qty";         lbl.fontstyle = fontstyle.normal;         lbl.fontsize = 15;         lbl.alignment = nguitext.alignment.right;          nguitools.addchild (gameobject.transform.gameobject, label.gameobject);     }      void fixedupdate() {         lbl.text = gameobject.transform.childcount - excess + "";     } } 

here example of how change font of uilabel uses dynamic font in ngui.

the label shows text in original font 2 seconds, switches other font (the 1 assign otherfont in inspector)

using unityengine; using system.collections;  public class changefont : monobehaviour {      public uilabel label;      public font otherfont;      ienumerator start() {         label.text = "this bit of text"; //show text         yield return new waitforseconds(2f); //wait 2 seconds         label.truetypefont = otherfont; //change font     }  } 

if label set use bitmap font, you'd assign uifont label.bitmapfont instead.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -