How to adapt same app to different screen resolutions/export targets?

Godot Version

4.5

Question

I’m developing an app and would like to have it present differently for different devices and different screen resolutions.

Now, I don’t simply want it to stretch a bit; I want to have a completely different layout depending on if it’s being shown on a mobile screen (tall and narrow) verses a tablet (wide). In one case the user controls should be on the bottom and in the other on the right.

Godot seems to lock you in to one screen size and I don’t see any way to write for multiple configurations. Do I need to create a new project for each presentation style? How would I share common code between projects?

You can use feature tags to customize your export presets.

If you need more control about how the exporting happens then you can write a plugin with an EditorExportPlugin

1 Like

I’m not sure I completely understood your response.

Since portrait mode has such a different aspect than landscape, I want do design a completely different UI for when the app is in portrait mode. I’ve added a different window size for ‘mobile’. However, there seems to be no way to switch to it. Even though I’ve added different dimensions for the mobile window settings in the project properties, the default settings are still used in the editor. Even if I set the feature tag from All to mobile, the editor’s design aspect for my mobile page is still the landscape size.

I think the answer you got gave a pretty good response. There are many feature tags that will give you a lot of information about where your game is currently running, and based on those tags you can use different controls that you made, change aspect ratio etc… during startup or even during runtime.

Part of the issue is that it is tough to design for both portrait and landscape in the same project. The editor it set up to lay things out according to the window size you set in the project settings. So if I make it landscape proportions, that makes it very difficult to create a second component that is portrait. I’d have to go back in and change the window size in the project settings every time I want to switch the aspect ratio I’m designing for.

Also, when I run the project, Godot seems to prevent me from making the horizontal of the screen smaller than the window design size. So even if I could detect the window resizing to that aspect, Godot seems to stop it from happening in the first place.