【问题标题】:Unity3d UI issue with Xiaomi小米的 Unity3d UI 问题
【发布时间】:2019-01-19 15:00:29
【问题描述】:

在小米设备中,会在相机信箱之外绘制图像 在其他设备中,一切都是正确的 我附上了sumsung和xiaomi的图片,截图看起来丑的是小米,三星好看

浮动目标方面 = 750f / 1334f;

    // 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;
    }

【问题讨论】:

  • 在最后一张图片(sumsung截图)中,我刚刚注意到没有信箱。
  • 因为它有很好的屏幕尺寸比例。我想表明在非小米设备中,信箱没有问题(仅显示黑色)

标签: user-interface unity3d xiaomi


【解决方案1】:

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

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

【讨论】:

  • 它不起作用,我已经设置了重复换行模式!我的意思是这不是重复纹理的问题。
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多