缩放用户界面以支持多种分辨率/不同的设备 [英] Scale UI for multiple resolutions/different devices

查看:104
本文介绍了缩放用户界面以支持多种分辨率/不同的设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的统一GUI,它具有以下方案:

I have a quite simple unity GUI that has the following scheme :

Brett和按钮在哪里.

Where Brekt and so are buttons.

GUI在PC上运行良好,并且在screen space : overlay上,因此应该可以自动调整以适合每个屏幕.

The GUI works just fine on PC and is on screen space : overlay so it is supposed to be adapted automatically to fit every screen.

但是在平板电脑上,整个GUI较小,并且在屏幕中央缩小,元素周围有很大的空白(现在无法加入屏幕截图)

But on tablet the whole GUI is smaller and reduced in the center of the screen, with huge margins around the elements (can't join a screenshot now)

解决该问题的方法是什么?是在播放器设置中还是项目设置中?

What is the way to fix that? Is it something in player settings or in project settings?

推荐答案

自动缩放UI要求结合使用锚点,RecTransform的枢轴点和

Automatically scaling the UI requires using combination of anchor,pivot point of RecTransform and the Canvas Scaler component. It is hard to understand it without images or videos. It is very important that you thoroughly understand how to do this and Unity provided full video tutorial for this.You can watch it here.

此外,当使用滚动条,scrollview和其他类似的UI控件时, ContentSizeFitter 组件还用于确保它们适合该布局.

Also, when using scrollbar, scrollview and other similar UI controls, the ContentSizeFitter component is also used to make sure they fit in that layout.

这篇关于缩放用户界面以支持多种分辨率/不同的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆