[Solved] TextMeshPro + unity 2019.3 : the text component is not updated if referenced externally.

See also:
My little story trying to use TextMeshPro with Unity 2019.2:

As I had issues with TextMeshPro and unity 2019.2 (partly my fault), I decided to try it out with the newly released 2019.3.

Reproduction:

  • Create a GameObject (let’s say “GameManager”).

  • Create a script:

  • Declare a TextMeshProUGUI variable

  • Have a score int variable which is updated in one way or another

  • Update function:

  •   void Update()
    

{Debug.Log("update score " + score);
scoreText.text = score.ToString();


- Create a Canvas with a TexMeshPro UI object
- ref this component in the GameManager through the Unity interface.
- Run -> score is updated, text display is not.

Tried with TexMEshPro 2.0.1 (official one), older 2.0.0 and preview.3 2.1.0

__**Important Note:**__
* attach the GameManager script to the TextMeshPro UI object.
* set the reference to the TextMeshPro UI object via GetComponent<>
* Run -> tadaaa: text display does update.

As you may imagine I do not want my GameManager to be attached to a UI component, this is a non-solution.

I tried to reproduce the setup you have described so I must have done something wrong as everything appears to be working as expected.

Attached is a scene and scripts to reproduce the setup I have. Please let me know where my setup might differ from yours so I can reproduce the behavior you describe and take a closer look.

5422941–551496–Repro Example.unitypackage (3.9 KB)

Again thanks a lot for taking this time.
Well … I do not know what to say.
I tried your package and it worked perfectly (I even saw it is based on .Net 2).
Then I tried in my project, and … It is working perfectly.
I have absolutely no idea of what I did differently just now compared with yesterday.

Another issue I had at some point, I did not mention, is that the text was updating only when I stopped the game. But it happened during a small series of run and not any more afterwards.

[Edit]
Just tried to reimplement the Text mesh pro in an old branch, which had the issue, and it is working perfectly as well.
I’m voiceless …