How to change screen orientation with code

Godot Version

v4.2.stable.official [46dc27791]

Question

Hello, I am wondering how to change the screen orientation for mobile in Godot 4.2? Everything I’ve found so far suggests using OS.set_screen_orientation, but this appears to have been removed since Godot 2.1 (based on the Godot docs page for OS), and have confirmed it just gives an error in 4.2.

Was this functionality moved elsewhere, or is it simply not currently available? What I want to do is have it effectively change the Display > Window > Handheld > Orientation setting at runtime…

It was moved to DisplayServer.screen_set_orientation()

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.