Use code tags:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class timertest : MonoBehaviour
{
public GameObject Timer;
public class timer : MonoBehaviour
{
public Text timerLabel;
private float time;
private void Start()
{
time = timerLabel;
}
void Update()
{
time += Time.deltaTime;
var minutes = time / 60;
var seconds = time % 60;
var fraction = (time * 100) % 100;
timerLabel.text = string.Format("{0:00} : {1:00} : {2:000}", minutes, seconds, fraction);
}
}
}
And for starters… you have a script nested inside another script. Though technically valid C#, it doesn’t meet the requirements of how Unity expects MonoBehaviours to be written (all MonoBehaviours/components should be contained in its own .cs file, and the filename should match the class name).
Also, the only line that throws a compiler error for me is this one:
time = timerLabel
And that’s because you’re attempting to set the float time with a Text object timerLabel.