初學Unity3D——編寫腳本(hello world)

本日誌,隨時更新

今天學了最基礎的打印“hello world”
首先,創建C#腳本(Assets-create-C# Script)
可重命名自己需要的名字,雙擊打開,會彈出u3d默認編輯器

打開後的界面

在void Start()裏輸入代碼

using UnityEngine;

using System.Collections;


public class hello : MonoBehaviour {


// Use this for initialization

void Start () {

print ("hello world");

}

// Update is called once per frame

void Update () {

}

}

保存,把腳本拖拽到遊戲對象上,或主照相機

運行該場景即可看到“hello world”



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章