具有不同屏幕尺寸的Unity UI

时间:2020-07-26 09:49:47

标签: unity3d unity-ui

我正在制作游戏,并且UI出现问题。我使它与屏幕尺寸成比例。在16:9中,它看起来像我想要的: UI is where I want it to be.

但是当我切换到2160 x 1080时,我遇到了问题。 My UI is outside my game screen

我希望18:9的UI保持与16:9相同的位置。有什么解决办法可以使其保持在游戏范围内?

2 个答案:

答案 0 :(得分:0)

symfony-crud> php bin/console make:entity Task created: src/Entity/Task.php created: src/Repository/TaskRepository.php Entity generated! Now let's add some fields! You can always add more fields later manually or by re-running this command. New property name (press <return> to stop adding fields): > title In DebugClassLoader.php line 337: Warning: include(D:\OneDrive\ドキュメント\Project\Php\symfony-crud\vendor\composer/../symfony/console/Event/ConsoleErrorEvent.php): failed to open stream: No such file or directory make:entity [-a|--api-resource] [--regenerate] [--overwrite] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<name>] 对象-> Canvas组件:

随屏幕尺寸缩放 匹配= 0(垂直应用为0,横向为1)

然后您需要更改ui对象的锚点,以使其不从边界对齐,而是从中心对齐。

答案 1 :(得分:0)

如果您希望用户界面覆盖整个页面,请确保按住shif + alt并选择拉伸预设,而不论分辨率如何,Unity都将始终覆盖整个屏幕

Unity anchor preset

refrence