Unity3d Android Phone screen resolution problem

Source: Internet
Author: User

Android phone screen resolution of a variety of, resulting in poor grasp of development, fortunately, each engine on this screen resolution problem has a better way to handle; Unity3d also provides us with a good solution.

In Unity3d for Android game development, for different resolutions of the display effect is like the camera's automatic translation of the general, watched a lot of games, for the Unity3d development of Android game seemingly did not do the corresponding screen resolution processing, but with the camera's automatic movement, Make the scene bigger so that there is no blank background.

In fact, Unity3d development 3D game, for different resolutions, we only need to set 1 unique screen display area ratio (white is the aspect ratio), so that the display area will not be pulled along with the resolution of the change.

1 usingUnityengine;2 usingSystem.Collections;3 4 5  Public classResolution:monobehaviour {6      PublicCamera Maincamera;7     voidStart ()8     {9         //screen.setresolution ( A. A.TenMaincamera =Camera.maincamera; One         //float screenaspect = 1280/720; Now the mainstream of Android phones to distinguish.  A         //maincamera.aspect---> Camera aspect ratio (width divided by height) -Maincamera.aspect =1.78f; -     } the}

Unity3d Android Phone screen resolution problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.