소프트웨어/유니티
[유니티 입문] 타이머 사용하기
Bicha
2018. 6. 28. 11:02
유니티의 여러가지 시간 측정 방법중 한가지인 스탑워치 사용하기에 대한 방법이다.
using System.Diagnostics; using debug = UnityEngine.Debug; public class TimerScript : MonoBehaviour { Stopwatch sw = new Stopwatch(); float time; void Start(){ sw.Start(); } void Update(){ time = sw.ElapsedMilliseconds; if(time>5000){ sw.Stop(); debug.Log("Time: "+time); } }