check whether cursor is on button unity code example
Example: check whether cursor is on button unity
if(buttonRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y), true)) { // }
if(buttonRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y), true)) { // }