Search Unity

The first time a text is displayed, it lacks punctuation

Discussion in 'UGUI & TextMesh Pro' started by drHogan, Apr 19, 2021.

  1. drHogan

    drHogan

    Joined:
    Sep 26, 2012
    Posts:
    201
    Hi,

    I have a problem that is driving me completely crazy. I have a loading screen with a quote or tip sentence in the game. It's set dynamically before the screen is made to appear (I use I2 to translate the text).

    The text is also supposed to appear between quotation marks.

    Now, the first 2 times the screen is loaded after the game is started, it behaves in a very strange way. The string is usually shown and translated correctly, but it's stripped of the quotation marks, and in case of Japanese text, also of the punctuation. What's strange is that if I print the debug of the string I mean to assign to the text, and if I print the value of the .text attribute, both are correctly displaying the right string, with punctuation and quotation marks.

    After the 2nd t

    Screenshot_4.jpg

    This is where I debug and assign the stuff shown in the pic above

    Code (CSharp):
    1.             Debug.Log("\"" + LocalizationManager.GetTranslation(generated.Value) + "\"");
    2.             quoteUI.text = "\""+LocalizationManager.GetTranslation(generated.Value) + "\"";
    3.             Debug.Log(quoteUI.text);
    For the western languages I use a static IM Fell font, and for the asian languages I use a dynamic NotoSerif CJK.

    To add to the fun, if I change the language (doesn't matter which ones) the first 2 times I access the loading screen, it doesn't update the text, even though in the debug it's shown correctly, and it also doesn't show again the quotation marks.

    I hope I managed to explain it correctly, because it somehow feels like blackmagic to me. Specially considering that after these first 2 problematic times, then it works every time perfectly again until i restart the game or change language.

    I am using Unity 2019.2.8 and the latest TMP package. If it can be of any help, the text belongs to a panel that is not active when I set the values.

    Thanks in advance for your time, I hope it will help me out of madness!
    Cheers,
    Dr.H
     
  2. drHogan

    drHogan

    Joined:
    Sep 26, 2012
    Posts:
    201
    I tried everything, but this weird bug persists, I also tried ot refresh the mesh shape after calling the assignment, tried to postpone that to when the panel is active, etc, but the problem is still there. Anybody any idea? It's so weird and hard to debug properly...