- Home /
Question by
RMihai · Jul 05, 2014 at 03:03 AM ·
guitexturemouseclick
Detect mouse click on a GUITexture
I have several GUITextures in my scene and i want to get the name of the GUITexture that was clicked with the mouse.
I have tryied this: if(Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.MousePosition); if(Physics.Raycast(ray, out hit, 100.0f) string x = hit.transform.name; }
I dont want to use OnMouseDown/OnMouseUp, etc.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613153307im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Detect Mouse Click in a GUITexture 1 Answer
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
GUItexture not accepting mouse clicks 1 Answer
GUITexture 1 Answer
OnMouseDown() & OnMouseUp() for Android 0 Answers