NGUI 字体的动态加载

来源:互联网 发布:天刀太白女捏脸数据 编辑:程序博客网 时间:2024/05/01 13:41
如下

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

    UILabel uiLabel;
    public UIFont font1;
    public Font font2;
    // Use this for initialization
    void Start () {
        // 获得 UILabel
        uiLabel = GetComponent<UILabel>();

        // 位图的读取
        // uiLabel.bitmapFont = font1;
        
        //动态加载
        //// 获取字体
        //GameObject fontobj = Resources.Load("XXX/New Font") as GameObject;
        //UIFont font = fontobj.GetComponent<UIFont>(); 
        //// 修改字体
        //uiLabel.bitmapFont = font;



        // 矢量图的读取
        //// 修改字体
        //   uiLabel.trueTypeFont = font2;

        //  动态加载
        //Font font_test = Resources.Load("XXX/XXXFont") as Font;
        //uiLabel.trueTypeFont = font_test;

    }

}


0 0
原创粉丝点击