Hello, I am trying to make it so that a GUI button controls an objects visibility.
var icon : Texture2D;
var toggleBool = true;
var target : GameObject;
function OnGUI () {
GUI.Box (Rect (0,0,100,90), "Top-left");
toggleBool = GUI.Button (Rect (10,30,90,20), toggleBool, "turn on/off");
target.renderer.enabled = toggleBool;
}
However I am getting the following error:
**No appropriate version of 'UnityEngine.GUI.Button' for the argument list '(UnityEngine.Rect, boolean, String)' was found.**
Any idea of the issue or a fix?