void Update()
{
if (Input.GetMouseButtonDown(0))
{
mouseDown = true;
}
}
void OnGUI()
{
GUI.BeginGroup(new Rect(0, Screen.height-(Screen.height*0.2f), Screen.width, Screen.height));
GUI.Box(new Rect(0, 0, Screen.width, Screen.height), guiTex);
Rect r1 = new Rect (0, 0, 100, 100);
GUI.Button(r1, "1");
if (mouseDown == true && r1.Contains(Input.mousePosition))
{
if (player.shape == 1)
{
player.UseAbility();
}
else
{
player.SwitchShape(1);
}
}
}
Can anyone explain to me why the button only works when I click the “lower-half” of it?