How to show the same part of game on every aspect ratio on Android devices with Unity?

寵の児 提交于 2019-12-04 09:15:01

During init, use Camera.pixelRect to determine the Height and Width of the Device assuming the camera is fullscreen.

Store the Height and Width and then do some math with your default settings. Eg. Default settings is 480x854, pixelRect is 800x1280. So difference in width is 800f/480f. Do the same for height.

Use the difference and multiply it to the object at the top of the hierarchy.

Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!