Font.material 材质
var material : Material
The material used for the font display.。
用于字体显示的材质。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
private bool flag = false;
private float rate = 1;
private TextMesh t;
void Update() {
t = transform.GetComponent<TextMesh>();
if (Time.time > rate) {
if (flag) {
t.font.material.color = Color.yellow;
flag = false;
} else {
t.font.material.color = Color.red;
flag = true;
}
rate += 1;
}
t.text = "This is a 3D text changing colors!";
}
}
// Swap 3D Text font color each second
// Add this script to a text mesh object
//每2秒切换3D文本字体颜色,添加这个脚本到一个文本网格物体
private var flag : boolean = false;
private var rate : float = 1;
private var t : TextMesh;
function Update() {
t = transform.GetComponent(TextMesh);
if(Time.time > rate) {
if(flag){
t.font.material.color = Color.yellow;
flag = false;
} else {
t.font.material.color = Color.red;
flag = true;
}
rate += 1;
}
t.text = "This is a 3D text changing colors!";
}
最后修改:2010年12月9日 Thursday 22:11