Search Unity

TextMesh Pro URP randomly pulling horiz text bounds -50%

Discussion in 'UGUI & TextMesh Pro' started by MrLucid72, Aug 31, 2021.

  1. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    996
    What could possibly cause this (players call it a "new line" bug)? We only experienced this when we swapped over to URP (now using the imported SDFs):



    upload_2021-8-31_13-6-26.png

    upload_2021-8-31_13-7-31.png
    ^ Intended text placement:


    It's as if all the horizontal text bounds shrunk -50%. I can't repro this in Unity, so it may be a Win64 Standalone issue? I haven't tried to repro in standalone yet - just a guess so far.

    --
    Players report the text placement initially works fine for a while, then once a scene loads back in async/additively, it happens to them until they restart the game (throughout all scenes after it triggers).

    For example,
    +Lobby
    +Game loop, -Lobby
    -Game loop, +lobby

    No idea if it's actually a TMP+additive scene unloading/loading issue, but just an observation since it initially looks fine, then later breaks.

    --
    Unity 2020.1.9f1
    TMP 3.0.6
     

    Attached Files:

    Last edited: Aug 31, 2021
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Switching to SRP (URP or HDRP) could most certainly impact text rendering but should not have any affect on text layout.

    This looks like a layout issue perhaps Layout Component related which might have surfaced if you also upgraded to a newer version of Unity when you switched to URP.

    When those other scenes are loaded, perhaps there is some Canvas Scaler in the scene hierarchy which could affect those Layout Components (if for some reason scaling ends up changing).

    Let me know if any of the above helps or if you are able to reproduce the issue.
     
  3. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    996
    > Switching to SRP (URP or HDRP) could most certainly impact text rendering but should not have any affect on text layout.

    Oh, it had a MASSIVE impact: It was not a fun journey. I hope you can help future poor souls that upgrade to URP to have a more-smooth transition, somehow. We fixed most of these issues - just this remains, and only for some; and I'm not quite sure how to repro it.

    EDIT: I had a group of testers where none had this issue (on win64 standalone). It's not consistent. The only constant is that we never experienced this before the URP upgrade

    EDIT 2: Although... I did upgrade to the latest and greatest TMP package version; it's possible it's not URP-related, but package related.

    > if you also upgraded to a newer version of Unity when you switched to URP.
    I did not upgrade to a newer version of Unity, though.

    > When those other scenes are loaded, perhaps there is some Canvas Scaler in the scene hierarchy which could affect those Layout Components
    There are some canvas scalers, but it's pretty generic: FHD, expand, 100 px/unit.
    upload_2021-8-31_17-45-14.png

    We don't mess with the scalers through runtime - we just leave it "as is". In Unity, readjusting my window doesn't seem to do anything. However, maybe standalone causes this? Again, just theorycrafting, though.

    > "perhaps Layout Component related which might have surfaced"
    Is it possible this was never fixed, but only thought it was fixed? Is there a way you used to repro this that I could test out?
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    It could be package related and linked to Layout Components as well as these can behaves in strange ways from time to time.

    Are the text objects exhibiting this behavior Input Fields or just Text components?

    I did release a new preview of the TMP package which is version 3.2.0-prev.1. I would be curious to know if the issue also occurs with that release. This new release contains additional changes so, I am only suggesting this for testing purposes to try to isolate this current layout issue.

    Note: This new release includes changes related to URP which required changing the layout of the geometry of the text which in turn will require updating / re-importing the TMP Essentials Resources which includes the modified shaders. You could only import the new shaders if you have modified the other assets / resources contained in the TMP Essential Resources.