Unity: How To Make a UI Timer [Beginners Guide] + C# Script YouTube Video Tutorial: https://www.youtube.com/watch?v=GPwp0Bd7WnA&feature=youtu.be C# Script: using UnityEngine; using UnityEngine.UI; public class UITimer : MonoBehaviour { public Text TimerText; public bool playing; private float Timer; void Update () { if(playing == true){ Timer += Time.deltaTime; int minutes = Mathf.FloorToInt(Timer / 60F); int seconds = Mathf.FloorToInt(Timer % 60F); int milliseconds = Mathf.FloorToInt((Timer * 100F) % 100F); TimerText.text = minutes.ToString ("00") + ":" + seconds.ToString ("00") + ":" + milliseconds.ToString("00"); } } } Script Link: http://bit.ly/2LMGEQ9 https://ift.tt/eA8V8J
YouTube Video Tutorial: https://www.youtube.com/watch?v=GPwp0Bd7WnA&feature=youtu.be C# Script: using UnityEngine; using UnityEngine.UI; public class UITimer : MonoBehaviour { public Text TimerText; public bool playing; private float Timer; void Update () { if(playing == true){ Timer += Time.deltaTime; int minutes = Mathf.FloorToInt(Timer / 60F); int seconds = Mathf.FloorToInt(Timer % 60F); int milliseconds = Mathf.FloorToInt((Timer * 100F) % 100F); TimerText.text = minutes.ToString ("00") + ":" + seconds.ToString ("00") + ":" + milliseconds.ToString("00"); } } } Script Link: http://bit.ly/2LMGEQ9
from GameDev.net http://bit.ly/2W7YJfs
from GameDev.net http://bit.ly/2W7YJfs
ليست هناك تعليقات