NGUI动态创建UILabel

来源:互联网 发布:手机如何开淘宝店铺 编辑:程序博客网 时间:2024/05/21 09:17
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";    }}

0 0