I have a code where if I start click or touch the screen and drag for specific distance does something. I would like to check whenever it is over a specific area (lets say over UI like canvas). The main goal is to have the upper half of the screen to react on click and touch.
I tried to do so by creating new Rect. This works, but I can`t make the rect on upper part of the screen (right now it is on the lower part of the screen). I might be missing something, but the following code should create rect in the upper part of the screen, not ?
if (Input.GetMouseButtonDown(0))
{
Rect bounds = new Rect(0, 0, Screen.height / 2, Screen.width);
if (Input.GetMouseButtonDown(0) && bounds.Contains(Input.mousePosition))
{
Debug.Log("Touchableee!");
TouchableArea = true;
}
if (TouchableArea == true)
{
tap = true;
isDraging = true;
startTouch = Input.mousePosition;
TouchableArea = false;
}
}
else if (Input.GetMouseButtonUp(0))
{
isDraging = false;
Reset();
}
Any ideas are welcome, thank you...