Search Issue Tracker

By Design



Found in [Package]


Issue ID




[TMP] Soft hyphen Unicode is outputted when setting it through script if OnValidate is not used

Package: TextMeshPro


Reproduction steps:
1. Open the attached Project ""
2. In the Project Window under "Assets/Scenes" open "SampleScene.unity"
3. In the Hierarchy Window select the "HyphenationTest" GameObject
4. In the Inspector Window check the "Set Without Validate" property of "HyphenationTest" Script and enter Play Mode

Expected result: "Speditionskauffrau/mann" text is outputted
Actual result: "Spe\u00ADdi\u00ADtions\u00ADkauf\u00ADfrau/\u00ADmann" text is outputted if OnValidate is not used (attached Results.mp4)

Reproduces on: TMP 1.5.3 (2018.4.29f1), TMP 2.1.3 (2019.4.15f1), TMP 3.0.3 (2020.1.14f1, 2020.2.0b12, 2021.1.0a6)

-If OnValidate is enabled, the text is outputted as expected

  1. Resolution Note:

    This is not a bug but rather due to the use of "@" in front of the string which forces the string to be interpreted as a string literal where \u00AD is exactly those 5 characters instead of the interpreted single character soft hyphen.

    Removing the "@" in front the string will result in the text string being interpreted correctly. This is a C# convention and not specific to TMP.

    In terms of why calling OnValidate() results in the soft hyphen being interpreted correctly, that is simply due to the manual calling of OnValidate() tricking the text object in thinking the text is coming from the Text Input Box in the Inspector where there is special handling to allow users to enter Unicode Escape Sequences like \u00AD for UTF16 or \U000000AD for UTF32.

    I replied to the original post to provide this information.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.