【发布时间】: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