Update 和 FixedUpdate

Tutorial

·

Beginner

·

+0XP

·

5 mins

·

(268)

Unity Technologies

Update 和 FixedUpdate

如何使用 Update 和 FixedUpdate 函数实现每帧的更改,以及它们之间的区别。

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

上一教程:Awake 和 Start

下一教程:矢量数学

Languages available:

1. Update 和 FixedUpdate

using UnityEngine;
using System.Collections;

public class UpdateAndFixedUpdate : MonoBehaviour
{
    void FixedUpdate ()
    {
        Debug.Log("FixedUpdate time :" + Time.deltaTime);
    }
    
    
    void Update ()
    {
        Debug.Log("Update time :" + Time.deltaTime);
    }
}

Complete this tutorial