标签是对组件的一种扩展,让其具有标题和图标属性。
导出资源
代码实现
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
/*
* Author:W
* 标签属性
*/
public class GLabelTest : MonoBehaviour {
private GComponent root;
private GLabel label;
void Awake()
{
UIPackage.AddPackage("UI/Basics");
}
// Use this for initialization
void Start () {
root = this.GetComponent<UIPanel>().ui;
label = root.GetChild("frame").asLabel;
label.text = "道具";
}
// Update is called once per frame
void Update () {
}
}
运行结果如下