0 votes

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:

This is what it looks like in the default resolution:

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

I'm changing the resolution by changing the size in the viewport. I've tried changing it by code using setsizeoverride, 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:

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? :(
Thank you so much to anyone who takes the time to answer <3

Godot version 3.2.3
in Engine by (64 points)

1 Answer

0 votes

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?

by (1,499 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.