Camera ProjectionMatrix and Canvas Scaling - different results in 2018.3
Hi all,
when setting the camera's projection matrix the scale of an UI Canvas having RenderMode=ScreenSpace-Camera changes according to these settings. It seems that in 2018.3 this gives different values than before.
I made a new project with template 2D in both versions, 2018.2 and 2018.3. Then added an UI panel and an empty object with this test script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class Test : MonoBehaviour
{
private Matrix4x4 originalProjection;
public Camera cam;
public void OnEnable()
{
cam = Camera.main;
originalProjection = cam.projectionMatrix;
Matrix4x4 p = cam.projectionMatrix;
p[0, 1] = 0.5f;
cam.projectionMatrix = p;
}
public void OnDisable()
{
cam.ResetProjectionMatrix();
Debug.Log("Reset matrix, now=" + cam.projectionMatrix);
}
private void OnGUI()
{
GUILayout.Label("Original Matrix:\n" + originalProjection);
GUILayout.Label("Changed Matrix:\n" + cam.projectionMatrix);
}
}
Scaling of the Canvas is different in both Unity versions, see attached Screenshot.
As this breaks the results of my scripts: how can I get the same results in Unity 2018.3 as in the previous versions?
@$$anonymous$$majama Unfortunately no. The problem is still unsolved for me. :(
362 days later and I'm having the same symptoms in 2019.1 when I set the horizontal or vertical offsets in the projection matrix ([0,2] and [1,2]). The height is the same but the width is way too big.
Tried Camera.useJitteredProjection$$anonymous$$atrixForTansparentRendering to no avail.
Your answer
Follow this Question
Related Questions
Major Issues with Camera Switching 1 Answer
How to match position with Mini Map UI 0 Answers
How would I Consistantly 'Snap' a UI Element to the Edge of a Camera? 1 Answer
Canvas without Camera? 2 Answers