This is the code for the button:
public void ShowIt()
{
ec.t1Bool = GUI.Toggle (new Rect (25, 55, 100, 50), ec.t1Bool, "Turbina 2 MW");
ec.t2Bool = GUI.Toggle (new Rect (25, 95, 100, 50), ec.t2Bool, "Turbina 3 MW");
ec.t3Bool = GUI.Toggle (new Rect (25, 135, 100, 50), ec.t3Bool, "Turbina 1 MW");
GUI.Box (new Rect (Screen.width - 100, 60, 80, 25), ec.prod.ToString ()); // PRODUCED ENERGY
}
This is where the object instance is created (it is in the same script as the button):
public class PlayState : IStateBase
{
private StateManager manager;
private HydroElectric ec;
public PlayState (StateManager managerRef)
{
manager = managerRef;
Debug.Log ("Constructing PlayState");
ec = new HydroElectric();
}
Any hint?