Hi all !
I set up the screen orientation to sensor in the project settings (Display > Window > Handled > Orientation).
When I'm executing my game on a mobile device, I want to switch the layout according to this orientation.

orientation = OS.screen_orientation
	print ("SCREEN: " + str(orientation))
	var new_layout = null
	match orientation:

But orientation always returns "6" which is "SENSOR". I'm not able to retrieve Portrait or Landscape.
How to do so ?

Many thanks.

I seem to recall that the last time I did that, I resorted to checking the window size. There might be a more elegant way, but I couldn't find it.

        get_tree().connect('screen_resized', self, 'resize')
...
        var wsize := OS.get_window_size()
        if wsize.y > wsize.x:
                # portrait
        else:
                # landscape

Thanks ! That's what I did, actually ! But I was wondering if there is a more elegant way 😉 Especially with the screen_orientation, which sounds great.... theorically 🙂 and which is not working, in practice.