class_name ModalBackdrop extends ColorRect func _ready() -> void: visible = false mouse_filter = MOUSE_FILTER_IGNORE UI.FOCUS_STACK.activeLayerChanged.connect(_onActiveLayerChanged) func _onActiveLayerChanged(layer:ClosableMenu) -> void: if layer == null or layer.get_parent() != get_parent(): visible = false mouse_filter = MOUSE_FILTER_IGNORE z_index = 0 else: visible = true mouse_filter = MOUSE_FILTER_STOP z_index = layer.z_index - 5