I don’t see the error anywhere and it’s on two other scripts :
Here is the script :
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class MyClockScript : MonoBehaviour
{
public int Minutes = 0;
public int Seconds = 0;
private Text m_text;
public float m_leftTime;
private float msecs;
private int savedSeconds;
public void Awake()
{
m_text = GetComponent<Text>();
msecs = 0.0f;
// the following allows you to either set Minutes && Seconds in the inspector
// or allows you to set m_leftTime in the inspector as the starting countdown for the clock
// Minutes && Seconds overrules m_leftTime
if ((Minutes == 0) && (Seconds == 0) && (m_leftTime != 0.0f))
{
// initialize Minutes & Seconds based on m_leftTime being set in the inspector
Minutes = Mathf.FloorToInt(m_leftTime / 60f);
Seconds = Mathf.FloorToInt(m_leftTime % 60f);
}
else if ((Minutes != 0) || (Seconds != 0))
{
// initialize m_leftTime based on Minutes or Seconds being set in the inspector
m_leftTime = (Minutes * 60) + Seconds;
}
savedSeconds = Seconds;
}
public void Update()
{
// count down in seconds
msecs += Time.deltaTime;
if(msecs >= 1.0f)
{
msecs -= 1.0f;
Seconds--;
if(Seconds < 0)
{
Seconds = 59;
Minutes--;
}
m_leftTime = (Minutes * 60) + Seconds;
}
if (Seconds != savedSeconds)
{
// Show current clock
m_text.text = string.Format("Time : {0}:{1:D2}", Minutes, Seconds);
savedSeconds = Seconds;
}
}
}