Unity3D Label 控件用于在屏幕上显示文本内容或图片。
GUI.Lable(位置, 标签显示内容);
例如:
GUI.Lable(new Rect(10,20,100,40), "我是标签");
将添加一个显示“我是标签”的标签,位置在界面的Rect(10,20,100,40)位置。
Rect()位置图解:
Rect(x, y, width, height)
标签示例:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Lable : MonoBehaviour {
public string str;
public Texture imageTexture = null;
private int imageWidth;
private int imageHeight;
private int screenWidth;
private int screenHeight;
// Use this for initialization
void Start () {
str = "HelloWorld