Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS sensor_landscape orientation only allows landscape left orientation #28848

Closed
narunsa opened this issue May 13, 2019 · 14 comments
Closed

iOS sensor_landscape orientation only allows landscape left orientation #28848

narunsa opened this issue May 13, 2019 · 14 comments

Comments

@narunsa
Copy link

narunsa commented May 13, 2019

Godot version:
3.1

OS/device including version:
Ipad ios 11.3.1

Issue description:
In project setting > handheld > orientation = landscape
In Export > IOS > orientation > check on landscape left and landscape right

Issue 1. After build my game ipad, it can't rotate. it stuck in landscape left.
Issue 2. So i try to build my game with only landscape right so i check only landscape right. image below

IMG_0092

@Benoit9
Copy link

Benoit9 commented Jun 19, 2019

I have the same issue. Changing the orientation in Xcode directly gives the same results (stuck in landscape left, or portrait with black bar).

@Benoit9
Copy link

Benoit9 commented Jun 19, 2019

In Project Settings > Display > Window > Handheld > Orientation : sensor
worked for me.

@akien-mga akien-mga changed the title IOS Orientation issue iOS Orientation issue Jun 19, 2019
@narunsa
Copy link
Author

narunsa commented Jun 19, 2019

@Benoit9 I change to sensor_landscape, It worked too.
Thanks.

@BastiaanOlij
Copy link
Contributor

One of these days these things should be unified, when the settings in xcode do not line up with the setting in projects things get wonky. I've run into this a few times with ARCore and ARKit (yes the same issue exists on Android)

Easier said then done though :)

@levis501
Copy link

Suggestion: add a tooltip in the export settings pointing to the project settings. e.g. "See also: Project Settings > Display > Window > Handheld > Orientation"

@Calinou
Copy link
Member

Calinou commented Jun 13, 2020

@levis501 Unfortunately, export preset settings can't have tooltips yet, so we'd have to implement that feature to display a tooltip.

@NianoTT
Copy link

NianoTT commented Mar 28, 2022

I run into the same thing, Orientation in Project Settings is set to sensor_landscape, the Orientation setting in Export seems to not exist anymore in 3.4.4, and the game ist stuck on landscape left on IOS (on Android, it rotates between landscape left and right as intended). Is it still possible to fix it by changing any other setting?

@Calinou
Copy link
Member

Calinou commented Mar 28, 2022

@nanitesnanites Please upload a minimal reproduction project to make this easier to troubleshoot.

the Orientation setting in Export seems to not exist anymore in 3.4.4,

In 3.4 and later, the duplicate Orientation setting in the iOS export preset was removed in favor of the project setting: #48943.

@NianoTT
Copy link

NianoTT commented Mar 28, 2022

@Calinou
MRP attached:
OrientationTest.zip

just a simple scene with an arrow to indicate orientation. Orientation in Project Settings is set to sensor_landscape. I also checked in XCode that both Landscape Left and Right are checked when importing the project, and they are, but the screen always stay at Landscape Left.

Edit: tested on iPhone 7 iOS 15

@Calinou
Copy link
Member

Calinou commented Apr 28, 2022

I wonder if the issue is here:

case OS::SCREEN_SENSOR_LANDSCAPE:
return UIInterfaceOrientationMaskLandscape;

Unlike SCREEN_SENSOR_PORTRAIT, there is no bitwise OR performed to combine LandscapeLeft and LandscapeRight.

In contrast, you can see that the Xcode generator adds both options:

case OS::SCREEN_SENSOR_LANDSCAPE:
// Allow both landscape orientations depending on sensor direction.
orientations += "<string>UIInterfaceOrientationLandscapeLeft</string>\n";
orientations += "<string>UIInterfaceOrientationLandscapeRight</string>\n";
break;

This quirk is present in both master and 3.x (but I linked to 3.x code here).

cc @naithar @bruvzg

@Calinou Calinou changed the title iOS Orientation issue iOS sensor_landscape orientation only allows landscape left orientation Apr 28, 2022
@Calinou Calinou added this to the 4.0 milestone Apr 28, 2022
@naithar
Copy link
Contributor

naithar commented Apr 29, 2022

I wonder if the issue is here:

case OS::SCREEN_SENSOR_LANDSCAPE:
return UIInterfaceOrientationMaskLandscape;

Unlike SCREEN_SENSOR_PORTRAIT, there is no bitwise OR performed to combine LandscapeLeft and LandscapeRight.

In contrast, you can see that the Xcode generator adds both options:

case OS::SCREEN_SENSOR_LANDSCAPE:
// Allow both landscape orientations depending on sensor direction.
orientations += "<string>UIInterfaceOrientationLandscapeLeft</string>\n";
orientations += "<string>UIInterfaceOrientationLandscapeRight</string>\n";
break;

This quirk is present in both master and 3.x (but I linked to 3.x code here).

cc @naithar @bruvzg

UIInterfaceOrientationMaskLandscape is basically a shorthand for UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight link, so it should be working correctly.

It also seems like the problem can be reproduced in Debug mode only. When running compiled app directly on device orientation changes correctly.

@naithar
Copy link
Contributor

naithar commented Apr 29, 2022

Adding [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; at the start of - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions in AppDelegate seems to be fixing orientation change in Debug build.

@akien-mga akien-mga modified the milestones: 4.0, 4.x Feb 22, 2023
@akien-mga
Copy link
Member

Is this still reproducible in 4.0 RC 3 or later? CC @bruvzg

@bruvzg
Copy link
Member

bruvzg commented Feb 22, 2023

Is this still reproducible in 4.0 RC 3 or later? CC @bruvzg

sensor_landscape seems to be working fine and rotate between both landscape orientations (tested on 10th gen iPad).

@akien-mga akien-mga modified the milestones: 4.x, 4.0 Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants