- Home /
Clicks from a track pad works, but not from a mouse
I have this simple grid made GUI buttons using 2 for loops, and each button calls a method when pressed on. However, the trackpad "taps" respond instantly, but the mouse clicks not give the same result.
void OnGUI()
{
int indexToShow = -1;
for(int x = 0; x < xSize;x++)
{
for(int y = 0; y < ySize;y++)
{
indexToShow++;
if(GUI.Button(new Rect(slotSize*x+5,slotSize*y+5,slotSize,slotSize),"Item"))
{
if(Input.GetMouseButton(0))
{
Clicked(indexToShow);
}
}
}
}
}
If pressed using a mice, clicked will always return -1, because its being set in the code, but why does the track pad return the proper value? Any way to have both the mice and track pad return the same value?
Comment
Your answer
Follow this Question
Related Questions
Detecting a GUI element under the mouse? 1 Answer
Disable Selection on Left button Mouse Click 3 Answers
Clickable GUI.Window 1 Answer
detecting if the mouse is inside any gui element 1 Answer
Detect a click outside a GUI/object 4 Answers