Hi,i dont know why i have an error in line 43.
(somewhere in public void HireWorker ()
{
StartCorountine(BonusPerSec());
})
Maybe someone can help me?I will be grateful.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour
{
public Text scoreText;
public GameObject Shop;
private int score;
private int bonus = 1;
[Header("Shop")]
public int[] shopBonuses;
public int[] shopPrice;
public Text[] buybttnText;
private void Update ()
{
scoreText.text = score + "$";
}
public void Shop_showorhide ()
{
Shop.SetActive(!Shop.activeSelf);
}
public void buybttn_addbonus (int index)
{
if (score >= shopPrice[index])
{
bonus += shopBonuses[index];
score -= shopPrice[index];
shopPrice[index] *= 2;
buybttnText[index].text = "BUY
" + shopPrice [index] + “$”;
}
else
{
Debug.Log(“Need more money”);
}
}
public void HireWorker ()
{
StartCorountine(BonusPerSec());
}
IEnumerator BonusPerSec()
{
while (true)
{
score += 1;
yield return new WaitForSeconds(1);
}
}
public void OnClick ()
{
score += bonus;
scoreText.text = score + "$";
}
}