RectTransform's bottom border changes in one resolution but in other doesnt change

huangapple go评论141阅读模式
英文:

RectTransform's bottom border changes in one resolution but in other doesnt change

问题

我为Unity的不同分辨率创建了UI自动缩放功能,对所有分辨率都有效,但在我的手机上,分辨率为1080x2400,我在Unity中尝试过,对象的边界未正确拉伸,因此出现了间隙。

画布数值

RectTransform's bottom border changes in one resolution but in other doesnt change

问题的视频:https://youtu.be/ol_hz5ntY1g

英文:

I made UI auto scale for different resolutions from Unity, and it works well for all of them, but on my phone i have resolution 1080x2400, i tryed it in Unity and borders of object dont strech right, so there appears a gap.

Canvas values

RectTransform's bottom border changes in one resolution but in other doesnt change

Video of problem:https://youtu.be/ol_hz5ntY1g

答案1

得分: 1

问题在于您的滚动视图的纵横比是固定的

=> 但是最后的分辨率具有不同的纵横比,因此空间没有填充。

您应该使用拉伸布局来填充剩余的空间。

由于您顶部和底部的按钮区域似乎不会动态更改大小,您可以简单地将您的滚动视图设置为类似于以下内容:

RectTransform's bottom border changes in one resolution but in other doesnt change

根据您顶部和底部按钮区域的高度调整这些值

英文:

The issue will be that the aspect ratio of your scroll view is fixed

=> the last resolution has a different aspect ratio though so the space isn't filled.

You should rather use a stretched layout for the scroll view in order to fill up the remaining space.

Since your button areas at top and bottom seem to not change sizes dynamically you could simply set your scroll view to something like e.g.

RectTransform's bottom border changes in one resolution but in other doesnt change

adjusting those values according to your top and bottom button area heights

huangapple
  • 本文由 发表于 2023年8月10日 19:37:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76875379.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定