Version: 2022.2
言語: 日本語
public static int frameCount ;

説明

The total number of frames since the start of the game (Read Only).

This value starts at 0 and increases by 1 on each Update phase.

Internally, Unity uses a 64 bit integer which it downcasts to 32 bits when this is called, and discards the most significant (i.e. top) 32 bits.

using UnityEngine;

public class Example : MonoBehaviour { // Makes sure that RecalculateValue only performs // some operations once per frame and no more. static private int lastRecalculation = -1;

static void RecalculateValue() { if (lastRecalculation == Time.frameCount) return; // ProcessData.AndDoSomeCalculations(); } }

Note: frameCount starts once all Awake functions have finished. The frameCount value is undefined during Awake functions.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961