Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Bug Screen Space Canvases easily dirty when modifying camera FoV

Discussion in 'UGUI & TextMesh Pro' started by vertxxyz, Aug 12, 2021.

  1. vertxxyz

    vertxxyz

    Joined:
    Oct 29, 2014
    Posts:
    109
    In
    CanvasScaler.SetScaleFactor
    there is a floating point check between two scale factors.
    In my game I found in 2019.4.29 there is significant lag due to many subcanvases recalculating their TMP text due to this.


    Changing this to an approximate check completely eliminated the lag and obviously no difference can be seen.

    I'm fairly sure this is the changing of the camera FoV driving it, but I cannot tell what's changing the renderingDisplaySize to be an inaccurate value.

    upload_2021-8-12_11-22-36.png

    Either way, floating point discrepancies shouldn't be able to filter down and cause canvas repaints.