我有一個非常煩人的錯誤,我統一做了一個秒表,這個錯誤不斷出現......這是代碼:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StopWatch : MonoBehaviour
{
float currentTime;
public Text currentTimeText;
void Start()
{
currentTime = 0;
}
void Update()
{
currentTime = currentTime Time.deltaTime;
TimeSpan time = TimeSpan.FromSeconds(currentTime);
currentTimeText.text = time.ToString("@mm\:ss\:fff");
}
}
我不知道該怎么做,我是 C# 新手。謝謝!:)
uj5u.com熱心網友回復:
改變:
currentTimeText.text = time.ToString("@mm\:ss\:fff");
到:
currentTimeText.text = time.ToString(@"mm\:ss\:fff");
或者:
currentTimeText.text = time.ToString("mm\\:ss\\:fff");
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/471709.html
上一篇:實體化游戲物件然后顯示ui
下一篇:如何從另一個場景腳本訪問場景