Setting screen orientation per scene not working on iOS

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Animazing

It seems that using OS.set_screen_orientation(OS.SCREEN_ORIENTATION_SENSOR_PORTRAIT) is not working on iOS. Whenever I switch from a landscape scene to a portrait scene on an IOS device using OS.set_screen_orientation(OS.SCREEN_ORIENTATION_SENSOR_PORTRAIT), the device opens the scene in landscape.
It is working fine on Android. I have some scenes that are in portrait and some that are in landscape. I verified that in Xcode all supported rotations are enabled.

Any clue what’s going on? I’m using Godot 3.5

:bust_in_silhouette: Reply From: Nouty1992

var osm = OS.get_singleton().as(“OSMobile”)
osm.set_screen_orientation(OS.PORTRAIT) or Godot Project Orientation Settings: Check your project settings in Godot to make sure that the orientation settings are set up correctly. Go to Project > Project Settings > Display and check that “Portrait” is enabled for both “Portrait” and “Upside Down” options.

I can’t find the get_singleton method in the Godot documentation, you sure that’s correct? I also don’t have the “Portrait” and “Upside Down” options, is this for Godot 4 perhaps?

Animazing | 2023-05-10 07:28