I want it to add a gold coin to the GUI every 2 seconds but it says that I earned the coin five times every second in the log and doesnt display it on my GUI. here is the part of the script related:
private int gold;
private float income;
private float currency;
void Start ()
{
income = 0.01F;
}
void FixedUpdate ()
{
currency = (income * Time.deltaTime);
if(currency > 2000)
gold += 1;
currency = 0;
Debug.Log("earned one coin");
}
void OnGUI ()
{
//Upper GUI
GUI.Box(new Rect(0,0, Screen.width, Screen.height - (Screen.height * 13) / 14), "");
GUI.Label(new Rect(Screen.width / 20,Screen.height / 40, Screen.width / 8, Screen.height / 8), "Gold:" +gold);
and I have all the closing tags with no errors.