This is my timer script which I want to stop playing and show the time in another scene. What do i need to do in order to do that ?
'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");'
'}'
'}'
'}'
在 StackOverflow 上搜索后,我找到了这个响应,它为您提供了几个选项: https : //stackoverflow.com/a/44542726/17331768
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.