Excuse me I want ask something about GUI button. I have this code at my gameobject where I render the texture to live cam, at the plane I render the output. But I give some image at output like a marker to take a photo like if that point in ur head or body. Then I have a GUI button, when I click it I want that marker not active or dissapear. How I can check OnClick int that GUI button in 1 script with this, not make 2 scripts where 1 scripts to render the cam, and 2 script to OnMouseDown or OnClick. Combine it to 1 script, render live cam then check the click. Can anyone help me with this ??
void Start ()
{
Debug.Log ("Script has been started");
marker = GameObject.Find ("marker");
plane = GameObject.Find ("Layar");
mCamera = new WebCamTexture (Screen.width, Screen.height, 60);
plane.GetComponent<Renderer>().material.mainTexture = mCamera;
mCamera.Play ();
}
void Update () {
}
void OnGUI() //I want to check if this GUI click but it doesn't work
{
if (makerON == true) {
marker.SetActive(false);
//GameObject.Find ("body maker").SetActive (false);
makerON = false;
} else {
marker.SetActive(true);
//GameObject.Find("body maker").SetActive (true);
makerON = true;
}
}