In addition to in-game representation of the UI screen and camera illuminates the screen Depth 0
The UICamera Depth 1.
If you set as your comment seems to do this in-game screen
I understand trying to make it look smaller screen thinking about that set the view port rect haejwoya Having had cleared it again
And this problem arises from the specific device
There was no problem in NGUI 3.5.6.
I want the camera to cut road area ratio to fit the screen.
----------------------------------------------------------------------------
if ((float)Screen.width / (float)Screen.height < ManualWidth / ManualHeight)
{
height = Screen.width * (ManualHeight / ManualWidth) / (float)Screen.height;
yPos = (1 - height) / 2f;
//height -= 0.00001f;
}
else
{
width = (float)Screen.height * (ManualWidth / ManualHeight) / (float)Screen.width;
xPos = (1 - width) / 2f;
//width -= 0.00001f;
}
Util.SetScissorRect(uiCamera, new Rect(xPos, yPos, width, height));
uiRoot.manualHeight = Mathf.FloorToInt(Mathf.Max(ManualHeight, ManualHeight * (ManualWidth / (Screen.width * (ManualHeight / Screen.height)))));
public static void SetScissorRect(Camera cam, Rect r)
{
if (r.x < 0)
{
r.width += r.x;
r.x = 0;
}
if (r.y < 0)
{
r.height += r.y;
r.y = 0;
}
r.width = Mathf.Min(1 - r.x, r.width);
r.height = Mathf.Min(1 - r.y, r.height);
cam.rect = new Rect(0, 0, 1, 1);
cam.ResetProjectionMatrix();
Matrix4x4 m = cam.projectionMatrix;
cam.rect = r;
Matrix4x4 m1 = Matrix4x4.TRS(new Vector3(r.x, r.y, 0), Quaternion.identity, new Vector3(r.width, r.height, 1));
Matrix4x4 m2 = Matrix4x4.TRS(new Vector3((1 / r.width - 1), (1 / r.height - 1), 0), Quaternion.identity, new Vector3(1 / r.width, 1 / r.height, 1));
Matrix4x4 m3 = Matrix4x4.TRS(new Vector3(-r.x * 2 / r.width, -r.y * 2 / r.height, 0), Quaternion.identity, Vector3.one);
cam.projectionMatrix = m3 * m2 * m;
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
It uses the code above problem occurred
Initially found it 's fresh because of projectionMatrix
However, even when a problem occurs to change the viewport rect without using "SetScissorRect"
To receive feedback about the solution to the problem.