unity入门
創建項目Helloworld
在Project窗口,選擇Assets,右鍵選擇Create->C# Script,創建一個腳本文件
編輯腳本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Helloworld : 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");
? ? }
}
在Hierarchy窗口選擇Main Camera,在菜單欄選擇Component -> Scripts -> Helloworld,將腳本指定給攝像機
運行場景,可以看到運行效果
保存場景為Helloworld.unity
在菜單欄選擇File -> Build Settings,打開Build Settings對話框
運行Build And Run,會生成Helloworld.exe,并且執行程序,最終效果如下。
總結
- 上一篇: CoreOS安装到硬盘
- 下一篇: 推荐一款好用的android反编译工具