Unity Canvas不会填充屏幕(Unity Canvas does not fill screen)

编程入门 行业动态 更新时间:2024-10-21 13:30:31
Unity Canvas不会填充屏幕(Unity Canvas does not fill screen)

我有一个2D游戏设置为1080p像素大小(所以每个单位等于1像素),我已经添加了一个画布到我的场景。 然而,画布仅填充屏幕的大约1/8,也不是中心。 所有画布大小和位置设置都被锁定,因此我无法移动它或调整其大小。 画布本身确实反映了屏幕(即如果我将文本放在右上角它正确显示),但是尺寸使得很难判断最佳位置元素的位置)。

如何让画布填满我的场景?

I have a 2D game set to 1080p pixel size (so each unit equals 1 pixel) and I have added a canvas to my scene. However the canvas fills only about 1/8th of the screen and is also not central either. All the canvas size and position settings are locked so I cant move it or resize it. The canvas itself does reflect the screen (ie if I put text in the top right corner it appears correctly) but the size makes it hard to judge where best to position the elements).

How do I get the canvas to fill my scene?

最满意答案

在画布上,将Canvas Scaler组件的Ui Scale Mode为Scale with Screen Size 。 然后,您可以定义1080p的Reference Resolution ,即1920 x 1080。

编辑:要查看画布是否适合场景中相机的大小,请将“ Canvas组件的“ Render Mode更改为“ Screen Space - Camera ,然后将相机从层次结构拖到其中。

On your canvas, set the Canvas Scaler component's Ui Scale Mode to Scale with Screen Size. Then you can define a Reference Resolution of 1080p, i.e. 1920 x 1080.

EDIT: To see the canvas fit into the camera's size in the scene, change the Canvas component's Render Mode to Screen Space - Camera, and drag the camera from the hierarchy to it.

更多推荐

画布,size,canvas,位置,电脑培训,计算机培训,IT培训"/> <meta name="description

本文发布于:2023-08-07 18:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465566.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:屏幕   Canvas   Unity   fill   screen

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!