Weird Viewport Behavior When Resolution Changes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alack Sunrider

Hey, everyone! I’m a CanvasItem noob, and I can’t for the life of me get this to work. I need to be able to change the resolution in my game, but if I do, the camera isn’t centered anymore. I think the problem has to do with the ViewportContainer node. Here’s my node structure:
Imgur

This is what it looks like in the default resolution:
Imgur

And this is what it looks like in 2x resolution (without any camera movement):
Imgur

I’m changing the resolution by changing the size in the viewport. I’ve tried changing it by code using set_size_override, but had the same results.
Reading the docs and some other questions in the forums, people suggested changing the stretch project settings, but it didn’t help. Here are my current settings:
Imgur

I also can’t remove the ViewportContainer, there’s a shader associated with it.
So, how can I change the resolution and keep the game scale and position? :frowning:
Thank you so much to anyone who takes the time to answer <3

:bust_in_silhouette: Reply From: Andrea

not really an aswer, but if the shader you are using is covering the entire screen, you dont need a viewport, you can use the SCREEN_TEXTURE, and load the shader on a blank ColorRect

by the way: could this be related to the Grow Direction property? It looks like the container is keeping the (0,0) (top left) unchanged, and grow toward the bottom right.
Have you tried using Grow Direction=both?