Search Unity

Issue on 2018.4.30LTS - UI Text cropping last character (always)

Discussion in 'Windows' started by fcloss, Feb 21, 2021.

  1. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Some users are reporting this bizarre issue, only on Windows. All UI texts are cropping the last character, every single UI text. We couldn't reproduce on our devices, but the problem exists, unfortunately. Is it known to anyone, someone from Unity's team?




    upload_2021-2-21_9-21-20.png
     
  2. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Seems to be solved on 2018.4.32
     
  3. Liam-C

    Liam-C

    Joined:
    Mar 6, 2017
    Posts:
    18
    I'm having this issue as well. I upgraded from 2018.4.18 to 2018.4.30 and the last character of every text element is cut off. But upgrading to 2018.4.32 didn't fix the issue for me. The issue also exists in 2018.4.34, the most recent LTS version.
     
  4. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Sometimes I also get notified by users that still have this issue. My app's currently deployed version is the .32. I was never able to reproduce it. So I believe the .32 solved for most but not all =Z
     
  5. Liam-C

    Liam-C

    Joined:
    Mar 6, 2017
    Posts:
    18
    I worked out a fix for my issue, but I'm not sure if it'll help you. I've customised my Unity UI library to add support for multiple event systems and an additional state for buttons. If you go into the Unity UI source code and look at the file history of Text.cs you can see that from 2018.3 and earlier, Text.OnPopulateMesh() always had this line:

    Code (CSharp):
    1. //Last 4 verts are always a new line... (\n)
    2. int vertCount = verts.Count - 4;
    In 2019.1 they removed the "- 4" and the comment about the new line, because they changed the way that the UnityEngine.TextGenerator (not part of Unity UI) creates vertices. It no longer generates vertices for invisible symbols and rich text tags, etc, which is a significant improvement. BUT, after the 2019.1 unity UI text change they created the 2018.4 branch which re-introduces the "- 4" to Text.cs, and this is what is breaking the text in my project. Seems like somewhere between 2018.4.18 and 2018.4.30 they've switched to the new Unity 2019 TextGenerator, but since they don't maintain the Unity UI open source repo anymore, they didn't update the 2018.4 branch to reflect that (The 2018.4 branch is specifically tagged 2018.4.3).

    So now I've upgraded to 2018.4.34, removed the "- 4" from my Unity UI source code which is forked from their 2018.4 branch, rebuilt my Unity UI libraries, and my text is fixed.

    Forum thread discussing the TextGenerator change:
    https://forum.unity.com/threads/possible-to-revert-to-2018-textgenerator-settings-in-2019.753686/
     
  6. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Thanks for that.

    I am tagging an Unity's developer so they can consider fixing it on 2018.4.

    Hi @phil-Unity, could you take a look at this issue with 2018.4?

    Thanks both.

    Kind regards
     
    Liam-C likes this.
  7. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Is the issue that you just need the 18.4 repo to be updated? its just custom builds that are a issue correct?
     
  8. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Thanks for the answer Phil. I have a few users with this issue, I couldn't reproduce it so far. But I know it still happens and I use the LTS versions unmodified. @Liam-C could check it more deeply. His solution was the one he mentioned, editing the UI source.
     
  9. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Ok if you are using the unmodified version then the fix from Liam-C wont do anything as its the source repo that hasn't been updated (i think) to remove the -4. Looking at the source there isn't the -4 and i dont see any references to it anywhere.

    I'd need a bug report with a good repo case to be able to track it down.
     
  10. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Ok. Thanks. I will tag him (@Liam-C), so if he wants do add any comments about it. Thanks again.
     
  11. Liam-C

    Liam-C

    Joined:
    Mar 6, 2017
    Posts:
    18
    Sorry, i only just saw this. Yes, this is correct in my case. People who want to customise the Unity UI library in 2018.4 will have to fork from the 2018.4 branch tagged 2018.4.3, which isn't compatible with the latest versions. I'm not sure the exact version where unity's text generator change was introduced, but its somewhere between 2018.4.18 and 2018.4.30. Since that UI source repo is no longer maintained, maybe a disclaimer in the readme would be sufficient

    I'm not sure about the use case for @fcloss. If your product is an asset store package I would guess that some of your users have customised UI libraries and are facing the same issue as me. But if you're talking about users playing a windows application that you've built then it might be a separate issue.
     
  12. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Hi Liam, it is exactly the second case, but I believe it was fixed from .32 on. Thanks.