using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayTme : MonoBehaviour
{
[SerializeField] TMPro.TextMeshProUGUI m_timeText;
void Update()
{
m_timeText.text = GetPlayTimeText();
}
public string GetPlayTimeText()
{
float playTime = Time.time;
int minutes = Mathf.FloorToInt(playTime / 60f);
int seconds = Mathf.FloorToInt(playTime % 60f);
return string.Format("{0:00}:{1:00}", minutes, seconds);
}
}
728x90
반응형
'공부 > Unity' 카테고리의 다른 글
[Unity] 유용한 링크 모음 (1) | 2025.06.09 |
---|---|
[Unity] 이미지 색이 이상하게 표현될 때 (0) | 2025.06.04 |
[Unity] Update vs FixedUpdate / GetAxis vs GetAxisRaw (0) | 2025.06.02 |
[Unity] 특정 물체를 바라보게 만들기 (0) | 2025.05.30 |
[Unity] 물리 2D (0) | 2025.05.29 |