NGUI動態建立UILabel

歡迎來到unity學習unity培訓、unity企業培訓教育專區,這裏有不少U3D資源U3D培訓視頻U3D教程U3D常見問題U3D項目源碼,咱們致力於打造業內unity3d培訓、學習第一品牌。jsp

 

 

下面咱們開始今天的Unity3D技能培訓。 咱們學習Unity3D培訓目標:讓U3D初學者能夠更快速的掌握U3D技術,自行製做修改素材,能夠獨立完成2D、3D小規模遊戲及網頁遊戲開發。學習

[csharp] view plaincopythis

 

 

  1. using UnityEngine;  
  2. using System.Collections;  
  3.   
  4. public class Test : MonoBehaviour  
  5. {  
  6.     public GameObject testBtn;  
  7.     public Font f;  
  8.     // Use this for initialization  
  9.     void Start()  
  10.     {  
  11.         UIEventListener.Get(testBtn).onClick += CreatLabel;  
  12.     }  
  13.   
  14.     // Update is called once per frame  
  15.     void Update()  
  16.     {  
  17.   
  18.     }  
  19.   
  20.     void CreatLabel(GameObject go)  
  21.     {  
  22.         UILabel label = NGUITools.AddChild<UILabel>(gameObject);  
  23.         label.trueTypeFont = f;  
  24.         label.text = "Test";  
  25.     }  

 

 

更多精彩請點擊 http://www.gopedu.com/3d

相關文章
相關標籤/搜索