I have a ColorRect with a script like bellow and a child Container node for a menu. My idea would be to hold the right button to show the menu, then you could click on the menu buttons with the left mouse button and release the right mouse button to hide the menu. Alternatively, releasing the mouse button presses a button, and hides the menu at the same time. But this isn't working. The menu is not receiving any events.
If I do a thing where I press the right mouse button to show the menu, then have to press it again to hide, the menu is functional, though.
func _gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_RIGHT:
if event.is_pressed():
$menu.position = event.position - menu.center
$menu.show()
else:
$menu.hide()