I have a really annoying error, I made a stopwatch in unity and this error keep showing up... Here's the code:
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");
}
}
I don't know what to do, Im new to C#. Thank you! :)
CodePudding user response:
change:
currentTimeText.text = time.ToString("@mm\:ss\:fff");
to:
currentTimeText.text = time.ToString(@"mm\:ss\:fff");
or:
currentTimeText.text = time.ToString("mm\\:ss\\:fff");