Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] When Camera2D enters tree, ensure first update is not lost #63581

Merged
merged 2 commits into from
Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scene/2d/camera_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,8 @@ void Camera2D::_notification(int p_what) {
// if a camera enters the tree that is set to current,
// it should take over as the current camera, and mark
// all other cameras as non current
_set_current(current);

first = true;
_set_current(current);

} break;
case NOTIFICATION_EXIT_TREE: {
Expand Down Expand Up @@ -437,7 +436,9 @@ void Camera2D::clear_current() {
void Camera2D::set_limit(Margin p_margin, int p_limit) {
ERR_FAIL_INDEX((int)p_margin, 4);
limit[p_margin] = p_limit;
Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
smoothed_camera_pos = old_smoothed_camera_pos;
}

int Camera2D::get_limit(Margin p_margin) const {
Expand Down