You will see under the void start function the currentWave. I want it to increment by 1 every 20 seconds. but not sure where and how to go about doing so. Below you will see my declared variables. I have left out the other section of code as it is not necessary for what I need.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawner : MonoBehaviour
{
private int currentWave;
private float startTime;
private float currentTime;
Above is my declared variables, and below is my stary function with currentWave set to 1, which is the integer I want to change every 20 seconds.
void Start()
{
currentWave = 0;
startTime = Time.time;
StartCoroutine(SpawnEnemy(TimeFrame[currentWave]));
}
void Update()
{
currentTime = Time.time - startTime;
Debug.Log(currentTime);
}
}
I used my update function to get the current "running time" of the program.