申请变量: public GameObject TextX; private float FloatX; 赋值方法: TextX.GetComponent<TextMesh>().text = FloatX.ToString();