(Case 1122419) Text not displayed until changing Component

The text of a “Text Mesh Pro UGUI” is not displayed, until the Component gets disabled/enabled or any of its properties are changed. Please see the video below.

The problem for me is that all texts in all menus are gone. It seems I have to toggle each Text Component in every menu, which is near one gazillion. Is there a workaround for this issue?

Video

Reproduce

  1. Open user attached project from Case 1122419
  2. Open Assets/menu.unity scene
  3. Expand in Hierarchy menu_pause > canvas > screens > main > buttons > resume button > button_main
  4. Select “Text” GameObject
  5. Notice its text is not displayed in the scene and game view
  6. Toggle the “Text Mesh Pro UGUI” Component
  7. Observe the text is now displayed

Actual
The TextMeshPro UGUI text is not displayed. The text is also not displayed when entering play mode.

Expected
The text should be displayed.

Note
Using TextMeshPro 1.3.0 package, which is 2018.3 verified.

I’ll take a look this afternoon and provide feedback once I have more information.

1 Like

The reason for the behavior is due to the fact the text “Input Source” is set to “Set Char Array” as seen in the image below when inspecting the text object with the Inspector in Debug mode.

4165687--367771--upload_2019-1-30_17-52-7.png

Now the Input Source mode is set internally based on the source of the input. For instance, if the text is set via the Inspector or string, then the mode is Text or String. If the text is set via SetText() then it is set to SetText. Lastly if the text is set using the .SetCharArray mode then the input is set to that mode.

So to resolve the issue, simply change this value to Text via the Inspector in Debug Mode.

Now the more challenging / puzzling question is how did the Input Source mode get into that mode in the first place. Are / were you at some point setting the text via this SetCharArray() function?

P.S. Thank you for having taken the time to submit the bug report with project as it made it quick / easy to find the cause. Without the Repro project, I would have been guessing for a while.

1 Like

OK, thanks for the quick help!

I never used SetCharArray, so that can’t be it. I guess it’s more likely that something went wrong during the upgrade process.

The project was using 2018.2 and the TMP package from the AssetStore. I then upgraded to 2018.3 and the TMP PackageManager version.

  • Upgraded the project to 2018.3
  • Removed the TMP asset store package
  • Added the TMP package from PackageManager
  • Ran your conversion tool

After these steps, 90% of the texts were gone.

Looking at the “Input Source” field though the Inspector, interestingly, some are set to “Text” while others are set to “SetCharArray”.

Most likely all of those with SetCharArray will exhibit the same issue so I would switch all of them to Text.

The challenge here is figuring out how they ended up this way but most likely not worth investing time into it since manually changing them to Text will solve the issue. Now if the behavior returns then it would be worth trying to isolate what steps might actually lead to this.

Interestingly enough this is the first occurrence of this behavior and fortunately for other users, this thread will provide some insight as to how to resolve potential text not rendering in the editor.

Is there any case when it should not be set to “Text”?

I’m asking, because we have some automatic data validation tests and I could add a test that this “Input Source” setting must be “Text” always. This would allow us to automagically catch if it changes again in our project.

But the test would only work if TMP never assigns something else than Text on purpose.

Yes.
If the text is set via the .text property then it will reflect “String”.
If it is set via the Inspector then “Text”.
If via SetText() then “SetText”
lastly if set via SetCharArray() to “SetCharArray”.

I’m having the same issue but the set input source is grayed out and I can’t change it. Strangly enough the input source is getting set to char array only when i play the scene before that it is set to text. Even stranger this is the exact game object that works perfectly in another scene in the same project. any suggestions?

I changed it in the .prefab / .unity scene files directly using just a text editor. Requires “Asset Serialization Mode = Force Text” (link).