(スクリプト)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.UI;
public class TimeCounter : MonoBehaviour
{
public Text timeLabel;
private float elapsedTime = 0;
private void Update()
{
elapsedTime += Time.deltaTime;
int m = (int)elapsedTime / 60;
int s = (int)elapsedTime % 60;
int cs = (int)(elapsedTime * 100) % 60;
timeLabel.text = string.Format("{0:00}:{1:00}:{2:00}", m, s, cs);
}
}
(実行結果)