Merge pull request #53459 from timothyqiu/camera-viewport-3.x

This commit is contained in:
Rémi Verschelde 2021-10-06 08:47:49 +02:00 committed by GitHub
commit 732dfddc20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -259,12 +259,13 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_EXIT_TREE: {
const bool viewport_valid = !custom_viewport || ObjectDB::get_instance(custom_viewport_id);
if (is_current()) {
if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
if (viewport && viewport_valid) {
viewport->set_canvas_transform(Transform2D());
}
}
if (viewport) {
if (viewport && viewport_valid) {
viewport->disconnect("size_changed", this, "_update_scroll");
}
remove_from_group(group_name);