Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Old Text Continues To Display When Text Is Empty

Discussion in 'UGUI & TextMesh Pro' started by Matt-Cranktrain, Apr 9, 2020.

  1. Matt-Cranktrain

    Matt-Cranktrain

    Joined:
    Sep 10, 2013
    Posts:
    129
    Hi Stephan, I'm using Text Mesh Pro preview.8 - 2.1.0

    I've got a bug where I change text to "" (an empty string) but whatever text I had before still keeps being displayed. The inspector confirms that the text mesh component should be displaying an empty string... but it isn't:



    Setting the text to anything else that isn't an empty string is fine.

    Also, setting the text to " ", as in, a string containing a single space (to fake an empty string) works fine! This is my current workaround to set the string to be empty.

    So, there's some regression in this preview version when it comes to empty strings, because this was working fine in the last stable/not-preview version, before I moved on over.

    Unhelpfully, I'm not entirely sure how to reproduce this, creating an empty scene and changing a TextMeshPro component in a script to have an empty string doesn't cause the issue. And I don't know why that is. Happy to give more information or try something if you have any ideas of anything to try.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you using the .text property or SetText() or a mixture of both?

    Is the scale of the text object or parent potentially affected when the text changes? Maybe affected by some layout component?
     
  3. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    I have encountered this too (it also can result in a completely incorrect visual result)
    upload_2020-4-15_13-58-45.png
    though I am still investigating exactly how to reproduce this one

    We're just setting .text directly but we do have some scaling on the parent objects and with some hacking I disabled that & it seems to fix the issue somehow.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The white text is the result of incorrect SDF Scale where in the case of the image above is close to a value of zero. This is likely the result of changing the scale of the text object which should always remain uniform in order to render correctly. It is fine to animate it but make sure at the end that x, y, z all end up the same.

    The text becoming visible is likely a rounding issue which I should be addressed in Preview 9 but I would like to get some repro project to make sure I have caught all potential variants of this. The one repro project I had where this was happening was the resulting of rotating the RectTransform which in turn was causing a floating point rounding error in the lossyscale.

    So if you can reproduce this issue please submit a bug report and provide me with the Case # as soon as you get it from Unity via email. I am planning on releasing Preview 9 within the next day or so and would love to verify this before then.
     
  5. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    That white block text only appears when a previously-set label has been set to an empty string, however. Otherwise our scaling & animating works fine. I don't know what is necessary to reproduce this bug so I doubt if I'll have much success trying to create a project but I'll try. My one guess is it's related to scaling.
     
  6. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    Ok that was quite easy.
    1238408
     
    Stephan_B likes this.
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you. I will take a look at it tomorrow since it is 2:00 am on my end and follow up as soon as I have more information. I am pretty confident I have already fixed this in Preview 9 but I'll will confirm.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just had a chance to take a closer at this issue and I should be able to include the fix in Preview 9 which I should be able to release over the weekend unless I run into any unforeseen issue in my testing.
     
    Last edited: Apr 17, 2020
  9. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    Any progress on this? I assume you encountered an issue delaying the release.
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I released Preview 10 last which includes that specific fix. Please update to Preview 10 and let me know if you still run into those issues.
     
  11. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    It seems like those issues are resolved but I have a new issue with text not being visible at all in some cases. I'm trying to narrow it down.
    It seems to be input fields mostly

    Edit: It seems that when the text length is below a certain portion of the whole text field the actual text stops rendering. I cannot find a way to reproduce this in a sample project though.
     
    Last edited: Apr 23, 2020
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Most likely related to the following issue which is fixed in Preview 11 which should be available in 30 minutes or so.
     
  13. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    That seems very plausible. Quick turnaround if so!
     
  14. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    If the parent Canvas of your input field(s) is in Screen Space Camera or World Space, that is likely the cause.
     
  15. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    That appears to have fixed it, thanks!
     
    Stephan_B likes this.
  16. Matt-Cranktrain

    Matt-Cranktrain

    Joined:
    Sep 10, 2013
    Posts:
    129
    Hi Stephan, just updated to Preview 11 and can confirm my original issue has been fixed. Thanks!
     
    Stephan_B likes this.