「毎日Unity」の技術ブログ

開発で役立つ情報を発信する

【UnityC#】経過時間を取得する方法

経過時間を取得する方法を自分用にメモ。

[ 取得方法 ]

「Time.Time」で取得できます。

[ 使用例 ]

下記はコンソールに経過時間を毎フレーム出力するスクリプトです。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScriptTest : MonoBehaviour
{
    void Update()
    {
        Debug.Log(Time.Time);
    }
}