Handheld orientation sensor: How to adjust viewport size?

Godot Version

Godot 4.6

Question

Hi…,

I want to use Portrait and Landscape mode for my iOS app. This works, when I set Project Settings… → Display → Window → Handheld → Orientation → Sensor.

  1. How to check, when the sensor changes the orientation?
  2. How to change the viewport size, that it fits to portrait, and landscape mode?

Thanks

Mike

Set your default window size to a square. Then make sure your UI fits in it and expands in both directions as you desire.

Then watch this video, which explains everything you asked about, plus a few more things:

1 Like