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

Changing the aspect ratio and resolution of the game view

You can easily switch between different resolutions and aspect ratios in the Game tab. This will allow you to see how your UI scales at the different resolutions and aspect ratios:

  1. If you navigate to your Game tab, you will see the words Free Aspect. Clicking on Free Aspect will reveal a menu that shows various aspect ratios and a single 1024x768 resolution that is labeled Standalone:

Free Aspect means that the window will scale to whatever resolution you set by changing the size of the game window. So by moving the frame around on the game window, you will change the aspect ratio. You can see this in effect easily by setting your Editor layout to one that shows both the Screen and Game tabs open simultaneously. For example, setting the Layout to 2 by 3 will do this.

  1. You can change the layout by selecting the word Default that appears in the upper-right hand corner of the Unity Editor.
  2. Now the Game and Scene tabs will both be visible on the left-hand side of your screen. Zoom out of your scene tab very far so that the square representing the camera looks small, as shown:
  1. Now, reduce the size of the game tab so that it is a very small thin rectangle. You will see that the main camera is now also displaying as a very small thin rectangle, because we are in Free Aspect ratio mode:
  1. You can select another aspect ratio, like 5:4, and you will see that as you rescale the game window, the blue area representing the actual game will maintain a 5:4 ratio and black bars to fill in any extra spacing. The camera will also maintain that ratio:
  1. Standalone (1024x768) will attempt to emulate the 1024x768 resolution. It's pretty likely that the window you have set for the Game tab is not big enough to support 1024x768 pixels; if so, it will be scaled as indicated in the following screenshot:

If the resolution or aspect ratio you want to use is not available in the resolution drop-down menu, you can add your own item to this menu by selecting the plus sign. If you want to create a set resolution item, set Type to Fixed Resolution. If you want to create a set aspect ratio item, set Type to Aspect Ratio:

For example, if I wanted to have a resolution item that represented the iPhone 6, add an item with the settings displayed in the following screenshot:

Once you hit OK, the iphone 6 item will be displayed at the bottom of the list. When you select it, the camera and visible area of the Game tab will maintain the aspect ratio created by a 1334x750 resolution:

主站蜘蛛池模板: 桦川县| 信宜市| 武宣县| 石景山区| 景洪市| 喀喇| 湄潭县| 北海市| 鹤山市| 宜州市| 重庆市| 会宁县| 河西区| 若尔盖县| 长沙县| 大安市| 鄂伦春自治旗| 本溪| 若尔盖县| 扬中市| 大兴区| 平南县| 桦南县| 龙山县| 罗江县| 肥西县| 潜江市| 枣强县| 阆中市| 灵宝市| 遂溪县| 革吉县| 山丹县| 寻甸| 通化市| 东安县| 金阳县| 临潭县| 大姚县| 石门县| 海阳市|