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中選定主攝像機,將寫好的腳本程序拖到最右下角的復選框,然后點擊中間運行按鈕

