Search Issue Tracker

Fixed in 2020.2.X

Fixed in 2019.4.X, 2020.1.X

Votes

2

Found in

5.4.0p3

Issue ID

833456

Regression

No

Canvas.ForceUpdateCanvases() doesn't update canvas before Camera.Render() is called

uGUI

-

Steps to reproduce:

1. Open attached project
2. Open scene "Scene"
3. In project tab click on "New Render Texture" and make sure that preview is enabled
4. Click on game view to make sure that it accepts keyboard keys
5. Press "2" and this will resize texture, call Canvas.ForceUpdateCanvases() and then Camera.Render()
6. Notice that render texture doesn't resize button
7. In scene view notice that canvas are resized

Additional steps:
8. Press "1" and notice that button isn't in the corner of render texture
9. In scene view notice that it should be in the corner

Reproduced with: 5.2.5f1, 5.3.6p6, 5.4.1p2, 5.5.0b5

  1. Resolution Note (fix version 2020.2):

    Canvas RectTransform size calculation now done for standalone renders as well. Partial fix: requires camera to be enabled during Camera.Render() call

Comments (3)

  1. FFF1969

    Apr 15, 2022 13:38

    This fix seems broken the camera.targetTexture feature.
    Before the fix, in 2019.4.14 or earlier version, this code can render the entire screen into a RT:

    var rt = RenderTexture.GetTemporary(1280,720);
    Camera.main.targetTexture =
    Camera.main.Render();
    Camera.main.targetTexture = null;

    After this fix, since 2019.4.15, the result will be different depends on the dispaly resolution.
    If larger than 1280x720, the screen capture is cropped. Cannot automatically scaled to the entire RT as the document descripted.

    I've submitted a bug, not sure whether it sill be fixed.

  2. Menion-Leah

    Feb 21, 2019 17:14

    Same issue here (2018.3.2f1).

    Seems quite weird that no explanation is provided when a case is closed as "Won't fix"

  3. illa3d

    Jan 20, 2017 13:28

    Experiencing the same issue. Unity 5.5.0p3.
    Has anyone found a workaround?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.