- Home /
GUITextures and ClickEvent
Hey, I have GameObject which has GUITexture Component attached onto it. Now this gameobject have GUITexture child. I know how to detect MouseClick on a Parent but how to also detect MouseClick on its child because it looks like this:
or maybe if I can get around this somehow but with same effect?
Answer by robertbu · Jul 31, 2014 at 07:06 PM
I don't understand how you've structured your script, but you can use HitTest() to make the check. So if you have a reference to the child GUITexture:
if (childGUITexture.HitTest(Screen.mousePosition)) {
Debug.Log("Child was clicked");
}
Your answer
Follow this Question
Related Questions
How can I access the children of a Transform? 5 Answers
Spooky NullReferenceException MYSTERY 3 Answers
Parenting a Parent? 1 Answer
Instatiate as a child of a GameObject 1 Answer
Instantiate Object and set its parent throws Null Reference Error 2 Answers