From ca850cc0ddf4b33da811f4fbe88d1b27f2218f4d Mon Sep 17 00:00:00 2001 From: Chaosus Date: Fri, 10 Jan 2025 15:31:50 +0300 Subject: [PATCH] Prevent warning emitting from `SubViewport` on scene loading --- scene/main/viewport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index e9dfbd6189c..33c8894edd1 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -5169,7 +5169,7 @@ void SubViewport::set_size_force(const Size2i &p_size) { void SubViewport::_internal_set_size(const Size2i &p_size, bool p_force) { SubViewportContainer *c = Object::cast_to(get_parent()); - if (!p_force && c && c->is_stretch_enabled()) { + if (!p_force && c && c->is_inside_tree() && c->is_stretch_enabled()) { #ifdef DEBUG_ENABLED WARN_PRINT("Can't change the size of a `SubViewport` with a `SubViewportContainer` parent that has `stretch` enabled. Set `SubViewportContainer.stretch` to `false` to allow changing the size manually."); #endif // DEBUG_ENABLED