阅读背景:

Unity中修改Text的内容_W__M123的博客_unity 修改text

来源:互联网 
  1. Unity中修改Text的内容
//Attach this script to a GameObject.
//Create a Text GameObject (Create>UI>Text) and attach it to the My Text field in the Inspector of your GameObject
//Press the space bar in Play Mode to see the Text change.

using UnityEngine;
using UnityEngine.UI;

public class Example : MonoBehaviour
{
    public Text m_MyText;

    void Start()
    {
        //Text sets your text to say this message
        m_MyText.text = "This is my text";
    }

    void Update()
    {
        //Press the space key to change the Text message
        if (Input.GetKey(KeyCode.Space))
        {
            m_MyText.text = "Text has changed.";
        }
    }
}//Attach this script t



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: