Unity3D课程学习笔记(一)
1.解释游戏对象(GameObjects)和资源(Assets)的区别与联系
官方文档对Assets的解释:An asset is representation of any item that can be used in your game or project. An asset may come from a file created outside of Unity, such as a 3D model, an audio file, an image, or any of the other types of file that Unity supports. There are also some asset types that can be created within Unity, such as an Animator Controller, an Audio Mixer or a Render Texture.
官方文档对GameObjects的解释:GameObjects are the fundamental objects in Unity that represent characters, props and scenery. They do not accomplish much in themselves but they act as containers for Components, which implement the real functionality.
解释区别与联系:对象一般是一些资源的集合体,是资源整合的具体表现,而资源可以被多个对象使用。游戏对象一般为玩家,敌人,环境等,而资源可组成游戏中所有的对象,一般包括声音,脚本,材质等,资源可以被多个对象使用,资源作为模版,可实例化游戏中具体的对象。
2.下载几个游戏案例,分别总结资源、对象组织的结构(指资源的目录组织结构与游戏对象树的层次结构)
游戏:Beat-Plane:如下图所示结构,资源中可以放置图像、声音、脚本等。
3.编写一个代码,使用 debug 语句来验证 MonoBehaviour 基本行为或事件触发的条件
测试代码如下所示:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour {
void Awake() {
Debug.Log ("In Awake!");
}
// Use this for initialization
void Start () {
Debug.Log ("In Awake!");
}
// Update is called once per frame
void Update () {
Debug.Log ("In Update!");
}
void FixedUpdate() {
Debug.Log ("In FixedUpdate!");
}
void LateUpdate() {
Debug.Log ("In LateUpdate!");
}
void OnGUI() {
Debug.Log ("In OnGUI!");
}
void OnDisable() {
Debug.Log ("In OnDisable!");
}
void OnEnabl