From 7331750618d9dfcdd60a3405ccd301057b7461f9 Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 3 Feb 2023 15:36:08 +0100 Subject: Fix Camera2D crash due to ParallaxBackground node --- scene/main/viewport.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scene') diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 19d16ae27e..28521c5bbe 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1062,6 +1062,10 @@ void Viewport::assign_next_enabled_camera_2d(const StringName &p_camera_group) { Camera2D *new_camera = nullptr; for (Node *E : camera_list) { Camera2D *cam = Object::cast_to(E); + if (!cam) { + continue; // Non-camera node (e.g. ParallaxBackground). + } + if (cam->is_enabled()) { new_camera = cam; break; -- cgit v1.2.3