window black content when resizing

How is it posible to “refresh”, so to speak, the contents of a window when resizing it.
It is only getting rendered correctly when windows resizing is released, but until then it shows a black background between the original windows size and the current. This is the code i’m using in the update function to resize the camera.

void Update()
        if (lastScreenWidth != Screen.width || lastScreenHeight != Screen.height)
            lastScreenWidth = Screen.width;
            lastScreenHeight = Screen.height;
    void Resize()
        float wantedAspectRatio = ((float)Screen.width / (float)Screen.height);
        double roundedAspectRatio = System.Math.Round(wantedAspectRatio, 1);
        double floorAspectRatio = System.Math.Floor(wantedAspectRatio);
        if ((roundedAspectRatio >= AR_5_4) && (roundedAspectRatio < AR_4_3))
            transform.GetComponent<Camera>().orthographicSize = Globals.CurrentBackgroundWidth / 2;
            transform.GetComponent<Camera>().orthographicSize = (Globals.CurrentBackgroundWidth * 42f) / 100f;


Is there a solution “refresh” or “redraw” during resizing window?
During resizing window, Update() function is not called.
We want to scale window contents(UI, textures, objects…) during resizing.