Unverified Commit 22db3010 by Rémi Verschelde Committed by GitHub

Merge pull request #31938 from KoBeWi/a_welcome_lag

Fix VisibilityEnabler2D behavior on start
parents dbd90b94 d0c5d910
......@@ -248,10 +248,19 @@ void VisibilityEnabler2D::_notification(int p_what) {
_find_nodes(from);
if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent())
get_parent()->set_physics_process(false);
if (enabler[ENABLER_PARENT_PROCESS] && get_parent())
get_parent()->set_process(false);
// We need to defer the call of set_process and set_physics_process,
// otherwise they are overwritten inside NOTIFICATION_READY.
// We can't use call_deferred, because it happens after a physics frame.
// The ready signal works as it's emitted immediately after NOTIFICATION_READY.
if (enabler[ENABLER_PARENT_PHYSICS_PROCESS] && get_parent()) {
get_parent()->connect(SceneStringNames::get_singleton()->ready,
callable_mp(get_parent(), &Node::set_physics_process), varray(false), CONNECT_ONESHOT);
}
if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) {
get_parent()->connect(SceneStringNames::get_singleton()->ready,
callable_mp(get_parent(), &Node::set_process), varray(false), CONNECT_ONESHOT);
}
}
if (p_what == NOTIFICATION_EXIT_TREE) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment