首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >小米的Unity3d UI问题

小米的Unity3d UI问题
EN

Stack Overflow用户
提问于 2019-01-19 23:00:29
回答 2查看 119关注 0票数 1

在小米设备上,在相机的信箱外面画了一张图片在其他设备上,一切都是正确的我附上了sumsung和小米的图片,看起来丑陋的截图是小米,三星的好看

float targetaspect = 750f / 1334f;

代码语言:javascript
复制
    // determine the game window's current aspect ratio
    float windowaspect = (float)Screen.width / (float)Screen.height;

    // current viewport height should be scaled by this amount
    float scaleheight = windowaspect / targetaspect;

    // obtain camera component so we can modify its viewport
    Camera camera = GetComponent<Camera>();

    // if scaled height is less than current height, add letterbox
    if (scaleheight < 1.0f)
    {
        Rect rect = camera.rect;
        rect.width = 1.0f;
        rect.height = scaleheight;
        rect.x = 0;
        rect.y = (1.0f - scaleheight) / 2.0f;
        camera.rect = rect;
    }

EN

回答 2

Stack Overflow用户

发布于 2019-01-19 23:18:34

尝试将图像设置为钳位,而不是重复。

这将产生黑色边框的结果,但你不会有那种奇怪的纹理

票数 0
EN

Stack Overflow用户

发布于 2019-02-05 02:34:52

我不知道是什么导致了这个问题,但我以一种棘手的方式解决了它。我刚刚添加了第二个摄像头来显示黑色背景。只有我的主相机的视口是信箱的,而不是第二个相机。所以它使显示看起来很好

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54268365

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档