godotengine / godotengine/godot
Unexpected resizing behavior between Godot Simulator and mobile hardware.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Reproducible in Godot 4.3 and 4.2 at least.
### System information
macOS 14.5 - 15.0 - Godot 4.3 and 4.2 stable - Mobile
### Issue description
The stretch mode is inconsistent between the Godot editor window and mobile devices. The window does exactly what you'd expect, where as the mobile device pins the screen to the upper left, meaning your game is stuck on phones like the iPhone pros due to the Dynamic Island (see image):

The stretch mode is set to Viewport and Aspect is set to Expand in order to fill the device screen without any black borders. In the first image, the game is as it appears in the editor. In the second image, the game is running in the Godot simulator (or whatever it's called). Stretch mode works perfectly when sizing the screen but the last image is on actual device hardware where the game screen is pinned to the upper left.
### Steps to reproduce
There is a text file explaining how to reproduce it in the MRP attached below. I also will paste it here:
Please note: This isn't so much of a bug as it is an unexpected behavior with the stretch settings.
If you run the scene and pull the window straight down, you'll get the expected behavior of the mode: viewport, aspect: expand Stretch settings. Many games want expansion to happen from the center so we can just add more of a scene behind the main game for different device sizes for anything that goes outside the camera.
If you run it on device, it does the unexpected (but current according to the docs) behavior of expanding from the top and adding space to the bottom.
In the document for ContentScaleAspect, it does state the content will expand from the bottom:
_ContentScaleAspect CONTENT_SCALE_ASPECT_EXPAND = 4
The content's aspect will be preserved. If the target size has different aspect from the base one, the content will stay in the top-left corner and add an extra visible area in the stretched space._
But that isn't the behavior you see in the game window of Godot nor is it really useful. In project settings the initial position type is set to "Center of Primary Screen" so the behavior I would expect is that the content expands from the center of the screen so that content can expand without black bars on the top and bottom.
### Minimal reproduction project (MRP)
[mrp-expansion-issue.zip](https://github.com/user-attachments/files/17037815/mrp-expansion-issue.zip)
Contributor guide
Research direction
Start by opening the attached mrp-expansion-issue.zip and reviewing the project’s stretch mode, ContentScaleAspect setting, and reproduction text. Compare the scene in the editor, Godot simulator, and mobile hardware, then determine whether the documented top-left expansion or centered expansion is intended; done means the behavior and documentation agree across these targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot
- Domain
- game-dev, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100