unity_GUI

  1. GUI是什么
  2. 步骤:先创建分数显示栏 再创建变量
  3. 位置
  4. (2017.3版本)写法:
    public UnityEngine.UI.Text tips;//注意这一行的写法!UnityEngine.UI是命名空间,Text是类
    int count;
    
    void RefreshTips()
    {
        tips.text = "Count" + count;//最后的count原则上写成count.ToString() 
    //不写也行,是因为unity会自动把count的类型从int转成string
    }

    老版本写法:(仅供参考,写法在新版本即将弃用)

    public GUIText tips;
    int count;
    
    void ReFreshTips()
    {
        tips.text = "Score:"+count;
    }
原文地址:https://www.cnblogs.com/lizitang/p/8430454.html