Awake 和 Start

Tutorial

·

Beginner

·

+0XP

·

5 mins

·

(271)

Unity Technologies

Awake 和 Start

如何使用 Unity 的两个初始化函数 Awake 和 Start。

本教程包含在“初级编程”项目中。

上一教程:作用域和访问修饰符

下一教程:Update 和 FixedUpdate

Languages available:

1. Awake 和 Start

using UnityEngine;
using System.Collections;

public class AwakeAndStart : MonoBehaviour
{
    void Awake ()
    {
        Debug.Log("Awake called.");
    }
    
    
    void Start ()
    {
        Debug.Log("Start called.");
    }
}

Complete this tutorial