diff --git a/modules/ui_extensions/touch_button.cpp b/modules/ui_extensions/touch_button.cpp index 38c7a955b..23b8750ee 100644 --- a/modules/ui_extensions/touch_button.cpp +++ b/modules/ui_extensions/touch_button.cpp @@ -31,8 +31,10 @@ void TouchButton::_notification(int p_what) { } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (Engine::get_singleton()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) { break; + } + if (is_visible_in_tree()) { set_process_input(true); } else { @@ -45,16 +47,19 @@ void TouchButton::_notification(int p_what) { } void TouchButton::_input(Ref p_event) { - if (!get_tree()) + if (!get_tree()) { return; + } - if (p_event->get_device() == -1) + if (p_event->get_device() == -1) { return; + } ERR_FAIL_COND(!is_visible_in_tree()); - if (is_disabled()) // no interaction with disabled button + if (is_disabled()) { // no interaction with disabled button return; + } Ref b = p_event;