Does Unity Mirror have any integrated timers?

76 views Asked by At

I'm making a multiplayer game on Unity with Mirror, and I want to add a timer (if it equals 0 then game ends).

Does Mirror have any integrated timers? Maybe I need do it myself.

1

There are 1 answers

1
UNREAL On

I used a coroutine:

void Start()
{
    StartCoroutine(Timer());
}

IEnumerator Timer()
{
    yield return new WaitForSeconds(1);
    while (timer != 0)
    {
        Debug.Log("Timer is not 0");
        if (timer == 0)
        {
            Debug.Log("Timer is 0");
            StopCoroutine(Timer());
        }
    }
}