I’m currently working on a clicker game but when ever I try and use a StartCoroutine for my autoticker it gives me the following two errors:
1: Assets/Scripts/GoldPerSec.cs(12,17): error CS1502: The best overloaded method match for UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IEnumerator) has some invalid arguments
2: Assets/Scripts/GoldPerSec.cs(12,17): error CS1503: Argument #1 cannot convert System.Collections.IEnumerable expression to type `System.Collections.IEnumerator’
using UnityEngine;
using System.Collections;
public class GoldPerSec : MonoBehaviour {
public UnityEngine.UI.Text gpsDisplay;
public Click click;
public ItemManager[] items;
// Use this for initialization
void Start () {
StartCoroutine(AutoTick());
}
// Update is called once per frame
void Update () {
gpsDisplay.text = GetGoldPerSec() + " gold/sec";
}
public int GetGoldPerSec(){
int tick = 0;
foreach(ItemManager item in items){
tick += item.count * item.tickValue;
}
return tick;
}
public void AutoGoldPerSec(){
click.gold += GetGoldPerSec();
}
IEnumerable AutoTick(){
while(true){
AutoGoldPerSec();
yield return new WaitForSeconds(1);
}
}
}