- Home /
On Gui Object Click
Hey guys, i have an important question. How can i use a GUI Image as a button, so something happens on click?
Comment
Answer by ina · Dec 23, 2012 at 11:40 AM
public Texture textureOfButton;
void OnGUI(){
if(GUI.Button(new Rect(10,10,50,50),textureOfButton)){
print("hi");
}
}
// drag and drop a texture on the public variable textureOfButton.
// replace print('hi") with whatever you want the button to do
Your answer

Follow this Question
Related Questions
apply click event in test 0 Answers
Reusable Canvas for enlarging images 2 Answers
Image appear when i click on a model 1 Answer
Cannot click on image multiple times 0 Answers