Im using the following code, all i need is the right if construct (commented in the code)
using UnityEngine;
using System.Collections;
public class Check : MonoBehaviour {
public Camera cam;
public bool enabled=false ;
public Component target;
void Update () {
//if (!enabled)
//{
// GetComponent(target) = false;
//}
}
void OnGUI () {
enabled = GUI.Toggle(new Rect(0,0,100,100), false, "Enable");
}
}