官术网_书友最值得收藏!

Setting the orientation

When building for mobile devices, you can't specify resolution and aspect ratio. However, you can choose between screen orientations in mobile devices. There are two different orientations: Landscape and Portrait.

Games built so that they are wider than they are tall are said to have landscape resolution. Games build that are taller than they are wide are said to have portrait resolution. For example, a 16:9 aspect ratio would be a landscape resolution, and a 9:16 aspect ratio would be a portrait resolution, as illustrated:

So, while you can't choose the exact aspect ratio of a mobile game, you can choose the orientation, which forces the aspect ratio to be either wider or taller. You can set the orientation by navigating to Edit | Preferences | Player Settings and selecting the mobile device. If you are building for both iOS and Android, you will not have to set these properties for both. As you can see from the following screenshot, the asterisk next to the property of Default Orientation states that the settings are shared between multiple platforms:

You can set the Default Orientation to either Auto Rotation, or one of the other rotations, as shown:

Unity defines the following orientations as the following rotations:

When you select a rotation other than Auto Rotation as the Default Orientation, the game will only play at that orientation on the device. If you select Auto Rotation, you will have the option to select between multiple orientations:

In most cases, it is best to choose only the Landscape orientations or only the Portrait orientations, but not all four. Generally, allowing all four orientations will cause issues with the game's UI.

Players tend to prefer to be able to rotate their games (especially if they're like me and like to play games in bed while their phone is charging), so unless you have a good reason to stop rotation, it's best to enable both Portrait and Portrait Upside Down or Landscape Right and Landscape Left.

主站蜘蛛池模板: 凤山县| 西宁市| 普洱| 宣武区| 江都市| 瑞昌市| 贞丰县| 漾濞| 安塞县| 临漳县| 青州市| 沾化县| 丰城市| 苏尼特左旗| 济源市| 专栏| 天水市| 金塔县| 阳江市| 广德县| 灵石县| 曲水县| 吉水县| 沙雅县| 扶绥县| 通河县| 五指山市| 木兰县| 石门县| 车险| 宁河县| 株洲县| 和硕县| 东乌珠穆沁旗| 郯城县| 什邡市| 和林格尔县| 天祝| 清丰县| 惠东县| 台北市|