Search Unity

TextMesh Pro Different behaviour for 'TMP_Text.SetText()' between Editor and Standalone

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by Gladyon, Jan 18, 2019.

  1. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    190
    The 'TMP_Text.SetText()' method doesn't have the same behaviour in the editor and in standalone.
    In the editor 'text' is immediately updated, in standalone it is not.

    Note that the 'text' setter is immediate in both cases, but it doesn't work with a StringBuilder.


    I made a tiny test project to reproduce the problem, it is attached to this post.
    Steps to reproduce the problem (first, we observe that it's OK in the editor):
    - open the 'TMPBug.zip' file
    - open the 'TMPBug' project with Unity 2018.3.0f2 (I haven't tested any other version)
    - open the 'SampleScene' scene
    - start the project
    - observe 4 texts:
    Left0 Right0
    Left1 Right1
    - click on the 'StartTest'
    - observe 4 texts:
    Left - Clicked Right - Clicked
    Left - Clicked Right - Clicked

    This is the normal behaviour, the top texts are set using 'text' for the left one and 'SetText()' for the right one, both are using constants as inputs.
    Then, the bottom ones are set using the text just above them as inputs, and using 'text' for the left one and 'SetText()' for the right one.

    Now, to reproduce the bug (now we observe the bug in standalone):
    - build a standalone version
    - start the standalone version
    - observe 4 texts:
    Left0 Right0
    Left1 Right1
    - click on the 'StartTest'
    - observe 4 texts:
    Left - Clicked Right - Clicked
    Left - Clicked Right0

    As you can see, the 'SetText()' method failed to modify the content of the top-right text in the same frame.
     

    Attached Files:

  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,312
    I'll take a look this afternoon or over the weekend.
     
  3. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    190
    This bug is still there in 2019.1.12f1 with TMP 2.0.1.
    I have issued a bug report, case 1174051.

    Note that it would also be quite interesting to also have some garbage-free features (such as 'SetText()') with the input field, but that's another matter.