帆布不正确地缩放,无论设定的可伸缩性如何

发布于 2025-02-10 13:03:11 字数 967 浏览 3 评论 0原文

无论屏幕尺寸如何,我都试图使我的画布可扩展。我使其在整个屏幕上都可以扩展,但是当它被隐藏并称其为某种原因时,它被称为缩放。我实际上将其称为代码,并且在需要时显示出来,但是它是不可扩展的,但是当我立即显示它时,它是可扩展的。

预期位置(当我不隐藏显示时,通常会显示):

实际位置(当我的显示被隐藏并在按钮上显示时):

如何使其可扩展?我已经搜索了所有可能的解决方案,但是找不到答案。

这些是设置和层次结构:

这些是父设置(主画布):

I'm trying to make my Canvas scalable regardless of screen size. I made it to be scalable across the screen but when it is hidden and called it is not scaled for some reason. I actually call it in code and it shows up when needed but it is not scalable but when I display it right away it is scalable.

Expected position (is displayed normally when I do not hide the display):
enter image description here

Actual position (when my display is hidden and is displayed at the button pressing):
enter image description here

How to make it scalable? I've searched for all possible solutions but I could not find an answer.

These are the settings and hierarchy:
enter image description here

These are parent settings (main canvas):
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

給妳壹絲溫柔 2025-02-17 13:03:11

我不确定为什么CanvassCaller对您来说还不够。我从来没有遇到过必须实现自己的诱人的情况

LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform);

I am not sure why CanvasScaller is not enough for you. I've never faced a case where I had to implement my own scalling, you should probably check CanvasScaller and use that, but anyway if your layout is not getting recalculated instantly you can force that by using

LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文