初学Unity3D——编写脚本(hello world)

来源:互联网 发布:php获取源码 编辑:程序博客网 时间:2024/04/30 00:24
本日志,随时更新

今天学了最基础的打印“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”



0 0