Godot Version
4.4.1
Question
Hey all, I am developing my game for Windows, Android, and iOS. I am doing all of my primary development on Windows, and then occasionally I will go and test things on the mobile platforms.
In the Project Settings I am using a “windowed” mode with 720x1280 resolution as recommended here for “mobile game in portrait mode”: Multiple resolutions — Godot Engine (stable) documentation in English
This works great for the main window. No issues. Even on Android screens that are not natively 720x1280, everything scales how I would like it to scale.
Now, there is one point in the game where I would like to display a fullscreen sub-window. I created a “Window” control and set it to “fullscreen”, but when I actually display the window it only displays at a resolution of 720x1280 - it doesn’t scale to fullscreen. I have also tried “exclusive fullscreen”, but that didn’t help.
How I can get my “sub window” to take up the full screen on Android? (The behavior on Windows that I would like is that it scales to take up the full space of the game’s main window)
The issue is that “expand” mode only scales up the camera accordingly, not control elements. Thus, they remain at the same size while the camera has a larger view. To fix this you either need to:
a) make custom control resizing code that runs when the window is different than 720x1280
b) use a different stretch mode like ‘keep_aspect’ Which will not scale out the camera but instead render everything the same just at a larger/smaller resolution. This has the downside of black bars appearing if the aspect ratio is different. However, it’s what I always use.
Maybe I didn’t explain the issue well enough. Anyway, I think I have found what the core problem is, but I still don’t know how to fix it.
Here is the core problem:
When the main window has “embed subwindows” turned on, then setting a subwindow to fullscreen does not work. Per the documentation: “This method only works with native windows, i.e. the main window and Window-derived nodes when Viewport.gui_embed_subwindows is disabled in the main viewport.”
Now, I do want to embed subwindows. But I also want my subwindows to have proper fullscreen sizing on Android (and on Windows I want them to be embedded and just scale to the size of the main window).
How can I achieve this?
Wouldn’t point a) still apply here? Sorry if I am being ignorant, but with some custom code you could scale the window size to fit the resolution of the device, if its not the 720x1280