unity3D寫一個hello world


unity3D寫一個hello world

打開unity並且在assets建立一個新的文件,新的文件命名為hello world.unity.接着創建一個新的C#Sript腳本文件,命名為hello world.C#Script,用VS2015打開並編寫該腳本程序。

代碼如下:

public class NewBehaviourScript : MonoBehaviour {

    // Use this for initialization
    void Start() {

    }

    // Update is called once per frame
    void Update() {

    }
    void OnGUI ()
        {
        GUI.skin.label.fontSize = 100;
        GUI.Label(new Rect(10,10,Screen.width,Screen.height),"hello world");
        }


}

 在unity中選定主攝像機,將寫好的腳本程序拖到最右下角的復選框,然后點擊中間運行按鈕

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM