summaryrefslogtreecommitdiff
path: root/scene/2d/camera_2d.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-02-01 23:32:13 +0100
committerkobewi <kobewi4e@gmail.com>2023-02-01 23:49:02 +0100
commit724d6581d64d3b8e99dae0bb1011edef8fbf700e (patch)
tree4e24c00029ccbb204e4604c3789bff947a786e26 /scene/2d/camera_2d.cpp
parent0a9e6e478e3183d7bf3c5cb895c706bc6275d3ea (diff)
Fix Camera2D crashes
Diffstat (limited to 'scene/2d/camera_2d.cpp')
-rw-r--r--scene/2d/camera_2d.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 49c5501e77..fe6bee0f1b 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -250,7 +250,7 @@ void Camera2D::_notification(int p_what) {
add_to_group(group_name);
add_to_group(canvas_group_name);
- if (enabled && !viewport->get_camera_2d()) {
+ if (!Engine::get_singleton()->is_editor_hint() && enabled && !viewport->get_camera_2d()) {
make_current();
}
@@ -260,11 +260,11 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
+ remove_from_group(group_name);
+ remove_from_group(canvas_group_name);
if (is_current()) {
clear_current();
}
- remove_from_group(group_name);
- remove_from_group(canvas_group_name);
viewport = nullptr;
} break;