How do I put this:
IEnumerator SomeCoroutine()
{
yield return new WaitForSeconds (1);
ouchies = ouchies + 1;
timelol.SetText("time: " + ouchies);
}
under a forever loop? i’ve already tried While loops and now im trying void update().
here’ the entire code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class timer : MonoBehaviour
{
public int ouchies = 0;
public TMP_Text timelol;
// Start is called before the first frame update
void Start()
{
StartCoroutine(SomeCoroutine());
}
// Update is called once per frame
private void update()
{
private IEnumerator SomeCoroutine()
{
yield return new WaitForSeconds (1);
ouchies = ouchies + 1;
timelol.SetText("time: " + ouchies);
}
}
}