- Home /
Screen.orientation problem with Unity 2020.3.4 - BUG?
This following code worked with Unity 2018 and Unity 2019.
public void ButtonScreenOrientationPortrait()
{
Screen.orientation = ScreenOrientation.Portrait;
Screen.autorotateToPortrait = true;
Screen.autorotateToPortraitUpsideDown = true;
Screen.autorotateToLandscapeLeft = false;
Screen.autorotateToLandscapeRight = false;
Screen.orientation = ScreenOrientation.AutoRotation;
}
public void ButtonScreenOrientationLandscape()
{
Screen.orientation = ScreenOrientation.LandscapeLeft;
Screen.autorotateToPortrait = false;
Screen.autorotateToPortraitUpsideDown = false;
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;
Screen.orientation = ScreenOrientation.AutoRotation;
}
I've downloaded the latest recommend Unity version 2020.3.4.
Now, it does not work on my Android smartphone anymore.
Why? Something changed in Unity? Can somebody confirm?
We're experiencing severe problems trying to do this in 2020.3.2f1 too. (I e force the screen to landscape or portrait and then allow the user to flip it upside down.) We had a working solution in 2019.4.9f1, before upgrading.
Hello,
We're experiencing exactly the same issue after upgrading the project from Unity 2019 to Unity 2020. Were you able to find any solution? Can you please share the solution with us?
Hi! I can confirm, same issue since "upgrading" to 2020, setting Screen.orientation = ScreenOrientation.AutoRotation
does not force the actual orientation on Android devices. I do notice that after moving the device, it gets updated and does not change again. I'm planning on reporting it as a bug.
Your answer
Follow this Question
Related Questions
Should I be checking Input.deviceOrientation, or Screen.orientation? 3 Answers
Bug?... Handling Android phone auto rotation orientation changes 1 Answer
Screen.orientation working different from screen that works from build. 0 Answers
Best solution for the iOS6 autorotation issue 1 Answer
Orientation Problem - Tablet vs Phone 0 Answers