Issue with Camera after upgrading Unity version

I recently upgraded a project from 5.5.6f1 to 2018.3.11f1. I solved most of my issues(textMeshPro conversion), but I have run into an issue with my Main Camera.

I have a script that inverts my camera for RTL users. This worked fine in 5.5 but in 2018 it changes the camera view to extremely small. I was able to reproduce it in a new project with just the invert camera script.

Step 1:

  • create a new 2D project in 5.5.6f1.
  • add a new UI > Canvas.
  • add a new UI > Image to the Canvas (make the image take up the left half of the Canvas)
  • add a new UI > Text to the Canvas( add it to the right side of Canvas)
    Step 2:
  • Add a ‘New Script’ Component to the Main Camera. (invertCamera.cs)
  • Add this to the new invertCamera.cs.
    private Camera myCamera;
    public bool invert;

    void Start()
    {
        myCamera = GetComponent<Camera>();
      
        this.enabled = false;

        if (invert)
        {
            this.enabled = true;
        }

        if (this.enabled == true)
        {
            Canvas[] canvases = Resources.FindObjectsOfTypeAll(typeof(Canvas)) as Canvas[];
            foreach (Canvas canvas in canvases)
            {
                canvas.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceCamera;
            }

            UnityEngine.UI.Text[] text = Resources.FindObjectsOfTypeAll(typeof(UnityEngine.UI.Text)) as UnityEngine.UI.Text[];
            foreach (UnityEngine.UI.Text obj in text)
            {
                obj.transform.localScale = new Vector3(obj.transform.localScale.x * -1f, obj.transform.localScale.y * 1f, obj.transform.localScale.z * 1f);
                switch (obj.alignment.ToString())
                {
                    case "0":
                    case "5":
                    case "UpperLeft":
                        obj.alignment = TextAnchor.UpperRight;
                        break;
                    case "MiddleLeft":
                        obj.alignment = TextAnchor.MiddleRight;
                        break;
                    case "LowerLeft":
                        obj.alignment = TextAnchor.LowerRight;
                        break;
                    case "4":
                    case "UpperRight":
                        obj.alignment = TextAnchor.UpperLeft;
                        break;
                    case "MiddleRight":
                        obj.alignment = TextAnchor.MiddleLeft;
                        break;
                    case "LowerRight":
                        obj.alignment = TextAnchor.LowerLeft;
                        break;
                    case "1":
                    case "6":
                    case "UpperCenter":
                        obj.alignment = TextAnchor.UpperCenter;
                        break;
                    case "MiddleCenter":
                        obj.alignment = TextAnchor.MiddleCenter;
                        break;
                    case "LowerBottom":
                        obj.alignment = TextAnchor.LowerCenter;
                        break;
                    case "2":
                    case "3":
                        Debug.Log(obj.alignment + " VALUE: " + obj.text);
                        break;
                }
            }
        }

    }

    void OnPreCull()
    {
        myCamera.ResetWorldToCameraMatrix();
        myCamera.ResetProjectionMatrix();
        myCamera.projectionMatrix = myCamera.projectionMatrix * Matrix4x4.Scale(new Vector3(-1, 1, 1));    
    }

    // Set it to true so we can watch the flipped Objects
    void OnPreRender()
    {
        GL.invertCulling = true;
    }

    // Set it to false again because we dont want to affect all other cammeras.
    void OnPostRender()
    {
        GL.invertCulling = false;
    }

Step 3

  • In the editor change the Canvas > Render Mode to ‘Screen Space - Camera’.
  • Add the ‘Main Camera’ to the ‘Render Camera’ value on the Canvas.
  • Switch the Canvas: Render Mode back to ‘Screen Space - Overlay’.

Step 4

  • Press play ‘Game’ should match the ‘Scene’ essential.
  • Stop the game and toggle the invertCamera value attached to the script you added to the ‘Main Camera’.
  • Now push play, the image and Text should now be opposite. Image on right Text on left w/ Text readable.

Step 5

  • Save Scene and Project then close project.
  • Open Project in Unity 2018.3.11f1.
  • Push Play with the invertCamera toggled off. Should work fine. Stop Play mode.
  • Toggle the invertCamera script on press play.
  • The Camera is zoomed in by about x100.

Please let me know if any of the steps are vague. Writing explanations is not a strong suit.

How do I fix this to where the Camera is not zoomed in on play mode when the invert camera script is used?

Thanks for any input.

(edit1: for more clearer instructions to reproduce.)
(edit2: I have a repo I can email to skip the setup process.)

Reserved for solution