This code disables the mouse from rotating something when mouseOverMainMenu is true. Before I fixed it, the mouse was only being disabled over box1 and not when trying to rotate while hovering over infoBarBox.
I changed it from this…
if(box1open)
{
Rect box1 = new Rect(box1X, box1Y, box1Width, Screen.height);
Rect infoBarBox = new Rect(infoBarX, infoBarY, infoBarWidth, infoBarHeight);
mouseOverMainMenu = (infoBarBox.Contains(Input.mousePosition) || box1.Contains(Input.mousePosition)) ? true : false;
}
else
{
Rect infoBarBox = new Rect(box1X, box1Y, infoBarWidth, infoBarHeight + box1BarHeight);
mouseOverMainMenu = infoBarBox.Contains(Input.mousePosition) ? true : false;
}
To this…
if(box1open)
{
Rect box1 = new Rect(box1X, box1Y, box1Width, Screen.height);
Rect infoBarBox = new Rect(infoBarX, 0, infoBarWidth, infoBarHeight);
mouseOverMainMenu = (infoBarBox.Contains(Input.mousePosition) || box1.Contains(Input.mousePosition)) ? true : false;
}
else
{
Rect infoBarBox = new Rect(box1X, 0, infoBarWidth, infoBarHeight + box1BarHeight);
mouseOverMainMenu = infoBarBox.Contains(Input.mousePosition) ? true : false;
}
And it was fixed. But I don’t have any real idea as to why changing those two Y-values to 0 fixed it. Anyone know?