How to make my game work in landscape mode only? (without screen rotation)
1 Like
- Go to
Edit > Project Settings > Playerit will openPlayer Settingsin the inspector. - Select the target platform from the list.
- Click the
Resolution and Presentationsection. - Set the
Default Orientationto Landscape left / right.
To allow both landscape options:
In Default Orientation select Auto Rotation.
Allowed Orientations for Auto Rotation will appear; select the options you want
void Start ()
{
Screen.orientation = ScreenOrientation.LandscapeLeft;//or right for right landscape
}
To make your app Auto Rotate in only some directions , you can
- Go to
Edit >> Project Settings >> Player. - Select the target platform (Android/IOS).
- Click on
Resolution and Presentation. - Under
Orientationset the Default Orientation toAuto Rotation. - Under that you will see a list appear
Allowed Orientations for Auto Rotation. - Select the one you want your app to
Auto Rotatein.
8 years later from the original post, Windows OS are also running on tablets and responds to screen rotation, but there is not a accessible UI in Unity 2021.3 from the Player setting dedicated to setting up orientation behaviour. Is it coding the only way to go?
