41342人加入学习
(116人评价)
Unity零基础入门 - 打砖块(Unity 2017) - 旧版
价格 免费

void Start(){

Debug.Log("Hello unity)

}

Debug是类,log是其中的方法

[展开全文]

//无论脚本有没有启用 都会执行且执行一次 void Awake(){}

//初始化,在脚本启用初始化时执行一次,仅执行一次 void Start(){}

[展开全文]

using UnityEngine;

public class Shoot : MonoBehaviour {

    public GameObject bullet;
    public float speed = 5;

    // Use this for initialization
    void Start () {
        Debug.Log("--Hello Unity!");

        //GameObject.Instantiate(bullet,transform.position,transform.rotation);
    }
    
    // Update is called once per frame
    void Update () {
        //Debug.Log("--Hello Unity! Update");

        if ( Input.GetMouseButtonDown(0) )
        {
            GameObject b = GameObject.Instantiate(bullet, transform.position, transform.rotation);
            Rigidbody rgd = b.GetComponent<Rigidbody>();
            rgd.velocity = transform.forward * speed;
        }

    }
}

[展开全文]

strat方法 执行一次

Updtae每一帧调用

[展开全文]

Debug.Log("Hello,unity");

打开控制台Window

 

[展开全文]

授课教师

SiKi学院老师

课程特色

图文(2)
下载资料(1)
视频(19)