Activate GuiTexture When Clicking on BoxCollider c#

How can i enable a gui texture when i click on a box collider in c# ?

public Camera theCamera; //set this to your camera in the inspector
public Texture2D YourImage; //set this to your image you want to show
private bool shouldIEnableTheGUITexture = false; //to determine if we need to show the image or not

void Update(){
    //if there has been a mouse click
    if(Input.GetMouseButtonDown(0)){
	    if(Physics.Raycast(theCamera.ScreenPointToRay(Input.mousePosition), out hit)){
	    //a collider was hit, if the name of that collider is "blah", the "blah" button was pressed!
            if(hit.collider.name.Contains("THE_NAME_OF_YOUR_GAME_OBJECT_WITH_THE_COLLIDER"){
                //enable gui texture
                shouldIEnableTheGUITexture = true;
            }
        }
    }
}

void OnGUI(){
    if(shouldIEnableTheGUITexture){
        GUI.drawTexture(new Rect(0,0,100,100), YourImage);
    }
}

Only three things you need to do. Add your main camera to the inspector variable named “theCamera”, change “THE_NAME_OF_YOUR_GAME_OBJECT_WITH_THE_COLLIDER” to the name of your gameobject that has the collider, and add your image in the inspector. Attach this script to any gameobject.