`
wgcode
  • 浏览: 577720 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

NGUI动态创建UILabel

阅读更多
using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour
{
    public GameObject testBtn;
    public Font f;
    // Use this for initialization
    void Start()
    {
        UIEventListener.Get(testBtn).onClick += CreatLabel;
    }

    // Update is called once per frame
    void Update()
    {

    }

    void CreatLabel(GameObject go)
    {
        UILabel label = NGUITools.AddChild<UILabel>(gameObject);
        label.trueTypeFont = f;
        label.text = "Test";
    }
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics