using System.Collections;using System.Collections.Generic;using UnityEngine;public class L07 : MonoBehaviour{// Start is called before the first frame updateprivate void Awake(){}void Start(){}// Update is called once per framevoid Update(){}}
Awake非常适用在脚本与初始化之间设置任何引用。
Start在Awake之后应用,而且是直接在首次更新之前调用。(前提是已启用脚本组件)
Awake和Start在脚本的一个生命周期内只能调用一次,不能通过禁用和重新启用脚本来重复执行Start 函数。
