Everything works fine, but the GUI label just shows 0 all the time ? i can see the “value” number counting up in my console but the GUI.label refuses to move from 0
using UnityEngine;
using System.Collections;
public class ResourceControl : MonoBehaviour
{
public int[] AddResource;
private int addResource = 0;
public int OutResources;
public int value;
void Awake ()
{
PlaceableBuilding.collectOil += this.CollectOil; // when collectOil is called we call CollectOil below
PlaceableBuilding.stopcollectOil += this.StopCollectOil;; // when stopcollectOil is called we call StopCollectOil below
}
public void CollectOil()
{
AddResource = new int[2];
addResource = addResource + 1; // This happens every 10seconds controll by another script
AddResource[1] = addResource;
int value = AddResource[1];
Debug.Log(value);
}
public void StopCollectOil()
{
Debug.Log ("Need to code");
}
void OnGUI()
{
GUI.Label(new Rect(100, 200, 100, 100), value.ToString()); // THIS IS THE LINE THAT IS NOT WORKING JUST SHOWS O ALL THE TIME
}
}