I have an idea for a menu where when you click on a button a bunch of other buttons appears:
private void OnMouseOver()
{
if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject())
{
//Do stuff
}
}
But I want it so that if you click again outside of the buttons the menu closes. I’ve tried:
private void OnMouseExit()
{
if (Input.GetMouseButtonDown(0))
{
//Do stuff
}
}
But this doesn’t work as it only registers when the mouse leaves the object and nothing else.