- Home /
Question by
smirlianos · Mar 01, 2014 at 03:11 PM ·
guitextureguitexturenameguilayer
GUILayer hit doesn't work. Any help?
Hello,
I have this script that is supposed to call a function if I click on a GUI Texture with the name "Finish". But nothing happens. The problem is in the if statement. If I remove it, it works perfectly... Any help?
#pragma strict
private var test : GUILayer;
test = Camera.main.GetComponent(GUILayer);
function Update() {
if(test.HitTest(Input.mousePosition) != null) {
if(Input.GetMouseButtonDown(0))
{
Debug.Log(test.HitTest(Input.mousePosition).name);
if(test.name == "Finish")
{
FinishTurn();
}
}
}
}
P.S.: The name IS "Finish" on the inspector!
Comment
Your answer
Follow this Question
Related Questions
GUITexture placement - Screen Resolution 1 Answer
GUI.DrawTexture on GUI.Button press 1 Answer
GUI_TEXTURE PROBLEM! 2 Answers
GUI.toggle and GUI.horizontalSlider to GUItextures. 0 Answers
GUI texture touch input problem 1 Answer