Search Unity

TextMesh Pro TextMeshPro text doesn't show up in built game

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by HewwoCraziness, Jun 27, 2018.

  1. HewwoCraziness

    HewwoCraziness

    Joined:
    May 4, 2018
    Posts:
    6
    My TextMeshPro text shows up both in the Scene and Game tabs in the Unity Editor, but not once I've built the game. I've tried building for both Windows and Mac with the same result.


    (in game)


    (in editor)

    No build errors appear in the Unity console.

    Thanks,

    HewwoCraziness
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    If you are using the Canvas System, make sure that you are using the TextMeshProUGUI text component and not the normal TextMeshPro component designed to work with the Mesh Renderer.

    If you are using the correct, text component, please post an image of your scene hierarchy expanded so I can see the configuration. Also post an image showing the text object inspector and its parents.
     
    forestrf likes this.
  3. HewwoCraziness

    HewwoCraziness

    Joined:
    May 4, 2018
    Posts:
    6
    Thanks for the prompt reply!
    Here's one of my broken text components in the Inspector view (all TextMeshPro components, both UGUI and InputField are blank once the app is built, but they're visible in both Scene and Game views):


    Here's its parent button:


    And here's the button's parent canvas:


    Thanks,

    HewwoCraziness
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Are you using a mixture of normal TextMeshPro objects and TextMeshProUGUI objects which would happen to be sharing the same material presets?
     
  5. HewwoCraziness

    HewwoCraziness

    Joined:
    May 4, 2018
    Posts:
    6
    All components using TextMeshPro are using the Text Mesh Pro UGUI script. Would you like me to upload my scene file?
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    A repro of the project / scene would be great.
     
  7. HewwoCraziness

    HewwoCraziness

    Joined:
    May 4, 2018
    Posts:
    6
    Sorry for the late response.

    Here's the MEGA link (252 MB): https://mega.nz/#!5cEAXAAZ!aGc28ueTqHC16T-hoOztfZXPnHXIT1FbUgVNM1ECuUI
    (Not sure if cloud service links are allowed, but there wasn't another obvious way to upload a large file.)

    The zipped version inside the archive (NetSet_Win.zip) is an outdated build where text still works.
    The folder version (NetSet_Win) is a very recent build where text is broken.

    Thanks so much!

    HewwoCraziness
     
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Finally had a chance to look at the repro project.

    In order to debug the dll only version and since you are running Unity 2018.1, I updated the project to the latest version of TextMesh Pro which is 1.2.3. This version is available via the package manager in Unity 2018.1.

    Prior to importing the new version, (1) I closed the current scene by going to New Scene. (2) Then deleted the previous version of TMP by deleting the "TextMesh Pro" folder. (3) imported the new version using the Package Manager. (4) Imported the TMP Essential Resources and TMP Examples & Extras via the menu. (5) Since the new package manager version of TMP uses a new set of GUID and FileID, I used the included "Project Files GUID Remapping Tool" to convert the project to the new format.

    Subsequently I created a new build where I discovered the text was rendering correctly. I suspect the behavior was addressed by one of the fix I did in release 1.2.3.

    Give this a try and let me know how it turns out on your end.

    P.S. I noticed in your project that you are using a lot of GameObject.Find("...").GetComponent<typeOf>() in Update() which is very inefficient and something you want to avoid. I suggest instead you define public fields and assign these references in the inspector. This will be much more efficient.
     
    P_Jong likes this.
  9. P_Jong

    P_Jong

    Joined:
    Jun 14, 2017
    Posts:
    51
    @Stephan_B Thanks. This fixed my problem upgrading from 1.2.1 to 1.2.4. The text TextMesh Pro text shows up now in the build. Edit: I should mention I'm using Unity 2018.2.0b11 build. I'm a big fan of Textmesh and have been using it before it got integrated into Unity 2018.
     
    Last edited: Jul 7, 2018
    Stephan_B likes this.
  10. sharkapps

    sharkapps

    Joined:
    Apr 4, 2016
    Posts:
    141
    I am also having problems with TextMeshProUGUI text disappearing when playing the game on a device (iOS). Everything looks fine in the editor, but not on the device.

    I am using Unity 2017.3.1f1. Is there a way to get 1.2.3 or newer for 2017.3 builds?
     
  11. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    I'll try to release version 1.2.4 (for 2017.4) next week. This version will work with 2017.3.
     
    P_Jong likes this.
  12. HewwoCraziness

    HewwoCraziness

    Joined:
    May 4, 2018
    Posts:
    6
    Worked great, thanks! (Didn't realize I had missing variable definitions; thanks for the notice.)
     
  13. lassade

    lassade

    Joined:
    Jan 27, 2013
    Posts:
    60
    I'm having this same issue with 2018.2.0f2 and TMP 1.2.4, from package mananger. TextMeshPro objects show as normal, TextMeshProUGUI in other hand are empty in all my builds.

    Edit:
    I'm building for Android;
    1.2.3 does not work;
    1.3.0-preview also does not work;

    Using canvas in Screen Space - Camera is the only way to make the text show up.
    Screen Space - Overlay does not work for any of the latest packages.
     
    Last edited: Jul 30, 2018
  14. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    See if any of the example scenes like 17 - Old Computer Terminal work correctly for you? Based on the information you provided it should since it is using a Screen space overlay.

    Then modify that scene to have the camera in screen space camera and see if that still works?

    I'll do some testing on my end as well.
     
  15. lassade

    lassade

    Joined:
    Jan 27, 2013
    Posts:
    60
    The scene 17 is working fine, but my scene is not working. I'm not sure what i'm doing wrong, at glance both the text componenets and canvas have the same setup apart from the font and aligment, I'm using the default LiberationSans SDF, center-middle
     
  16. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Are you using a mixture of normal <TextMeshPro> and <TextMeshProUGUI> components where these happen to share the same material?

    If so and as a result of the Canvas Renderer and Mesh Renderer having different requirements in terms of ZTest settings, these two systems end up fighting each other. To resolve the issue, simple use a different set of material presets for the Canvas system vs. the Mesh Renderer.
     
  17. ledbetterman

    ledbetterman

    Joined:
    May 5, 2015
    Posts:
    72
    I'm having the same problem. TextMeshPro v1.2.4, installed via package manager in Unity 2018.2.2.f1. Running Unity on a Mac running High Sierra 10.13.4.

    Everything looks fine in the editor, builds and shows all expected GUI elements minus text. I haven't mixed text mesh components (all UGUI).

    Building for Windows works fine, though that build was built on windows using the prior version of 2018.2 (i think it was the 2018.2.1f1??) I'm working on the same project on my mac via Collab and updated it to the newest version of 2018.2.

    Any assistance would be great.

    Edit:

    Tried setting my UI to Screen Space - Camera to no avail. I tried changing Text Mesh Pro materials from mobile to standard. This also did not resolve the issue.
     
    Last edited: Aug 4, 2018
  18. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Do any of the example scenes included with TextMesh Pro exhibit the same behavior?
     
  19. ledbetterman

    ledbetterman

    Joined:
    May 5, 2015
    Posts:
    72
    Yep, can confirm I'm having the same issue in the Single Line TextMesh Pro scene and the Old Computer Terminal test scene.
     
  20. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Just to confirm, Unity 2018.2.2 simply creating / running a Standalone build on Windows or OSX?

    Update: Just tested a Standalone build on Windows using Unity 2018.2.0f2 and both scenes ran and rendered correctly.

    Also tested the same two scenes on Unity 2018.2.2f1 and they also ran and rendered as expected.

    What graphic settings are you using? Graphic API? Resolution?

    What scripting backend?

    Are you getting any errors if you run a development build?
     
    Last edited: Aug 5, 2018
  21. ledbetterman

    ledbetterman

    Joined:
    May 5, 2015
    Posts:
    72
    No, the build with the issue is on Mac High Sierra on a 2016 Mac Book Pro. The Windows builds work fine for me too.

    I'm using the standard/legacy rendering pipeline with all default settings. Gamma color space with "automatic graphics API" selected for Mac. Resolution is variable; I've jumped between windowed and full screen. There appears to be a split second of dots on the screen before the scene view pops in completely, but it's so quick that I can't tell if it's artifact of text mesh pro or just the first rendered frame popping on screen.

    As for scripting back-end, it's Mono and the API compatibility level is .Net 4.x equivalent.

    I'm getting no errors whatsoever.
     
  22. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    I'll try testing on my MacBook Pro later tonight or tomorrow and provide feedback thereafter.
     
    ledbetterman likes this.
  23. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    I just ran those scene on the MacBook Pro using Unity 2018.2.2f1 and they also rendered and worked as expected.

    See if you get the same behavior in a new project using those same example scenes?

    Note that you will need to import the TMP Essential Resources as well as TMP Examples and Extras.
     
  24. K1kk0z90_Unity

    K1kk0z90_Unity

    Joined:
    Jun 2, 2013
    Posts:
    83
    I am having the very same problem using Unity 2019.1.0f2 with TextMeshPro 2.0.0. Building on Android it works fine. Building for iOS using Unity Cloud Build results in not showing all TextMeshPro texts. Furthermore, TMP_InputField also doesn't work.

    I think I'll have to use Unity built-in UI components only, otherwise I'm stuck not being able make a proper build on iOS.
     
  25. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Please update to version 2.0.1-preview.1.

    I'll re-run tests on iOS but that should all be working as expected. Do you get any errors when building for iOS via Unity Cloud?
     
  26. KazYamof

    KazYamof

    Joined:
    Jun 26, 2015
    Posts:
    56
    When I build to Android, none of my text are being displayed.
    Neither the TMProUGUI for canvas or TMPro attached to an object at world space.

    Works fine in Unity Editor.
    2019.1.2 and TMPro 2.0.1
     
  27. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Are you able to provide some repro of this for me to look at?
     
  28. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    112
    Are you using different assets + materials for the ugui and world space objects as suggested above? This has cleared up the issue for me. Along these lines, @Stephan_B any chance we could get this idiot proofed in a future release? At the very least, the behavior of the editor and builds should be consistent, but ideally it all 'just works' in some fashion.
     
  29. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    112
    Actually, I take back what I said. I also have this issue with TMPro and cloud build for iOS. @Stephan_B is this something you've been able to reproduce yet? My setup is quite simple, latest Unity, TMPro 2.0.1. I'm only testing world space elements, and have already assigned them a unique material (though I'm not using any UGUI components anywhere anyway).
     
  30. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    If you have a project where you can reliably reproduce this, please do submit a bug report with the included project and provide me with the Case # once you have it.

    In terms of the overlap on materials, it is using a mixture or normal <TextMeshPro> object with <TextMeshProUGUI> objects where they share the same materials.
     
  31. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    112
  32. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    228
    We are having the same issue.

    There is no mix and match of materials with UI/non UI elements. The scene is only using Unity Text and TMPROUGUI elements.

    This does not happen to all our users, only some users experience this while it is fine for others.
    How to debug what the cause is?
     
  33. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Does it happen only on certain devices?
     
  34. HaakonL

    HaakonL

    Joined:
    Mar 13, 2014
    Posts:
    113
    Hi, we are building with Unity Cloud Build and some texts are rendered in the center of the screen on Android, no matter what we do to place them correctly. We are using the "hack" with different materials mentioned above.

    2019.1.10, TMPro 2.0.1.
     
  35. HaakonL

    HaakonL

    Joined:
    Mar 13, 2014
    Posts:
    113
    One important finding here is that the texts are rendered at the correct spot if we use Vulkan rendering. With OpenGLES they end up in the center.

    We're using the TextMeshPro/Mobile/Distance Field shader, and the issue is with the 3d tmpro text component.

    Also running with LWRP, version 5.16.1.
     
    Last edited: Jul 25, 2019
  36. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Can you submit a bug report and include the project for us to look at?

    Please provide the Case # once you have it.
     
  37. HaakonL

    HaakonL

    Joined:
    Mar 13, 2014
    Posts:
    113
    We did not have the time to do this, fixed the issue by changing to the regular text component instead of the 3d. But the bug is easy enough to replicate - place a tmpro 3d text component in a canvas off-center. Build with Vulkan for Android - text correctly placed. Build with OpenGLES3 for Android - text incorrectly placed.

    Sorry for not creating a sample project for you, we're dealing with too many Unity bugs in 2019 and simply can't spend more time on issues where we are able to find workarounds. Unity 2019.1 has been a disaster for us, costing us thousands and thousands of dollars in lost time due to serious bugs, but it is unfortunately a requirement when we need LWRP.
     
  38. pxlshdr

    pxlshdr

    Joined:
    Jan 14, 2017
    Posts:
    1
    I have had the same issue.. the 3d Textmeshpro object render fine on Opengles2 and 3, but fails when I build to Vulcan. pretty sure this has something to do with it:

    Flip Space Coordinates
    Clip space coordinates differ by API. These are the coordinates that are output by your vertex shader and are consumed by the rasterizer. Each API's conventions are as follows:

    Format: [MinX,MaxX][MinY,MaxY][MinZ,MaxZ]

    • Direct3D11 and Metal: [-1,1][-1,1][0,1]
    • Vulkan: [-1,1][-1,1][0,1] NOTE: Vulkan's clip space Y axis is inverted compared to other API's.
    • OpenGL (ES): [-1,1][-1,1][-1,1]
     
  39. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    203
    does anyone have any news on this? we tried updating to 2018.4.7 but most of the textmeshproUGUI objects in the UI are dissapearing or switching the letters to weird things (as if the clip ranges of the material texture are all over the place). this happens when you do a build to webGL and you go fullscreen.

    This thing happened to me in the editor sometimes in the past and it simple fixed itself by just hitting play in the editor, never was a problem in builds or webGL but now it seems to be.
     
  40. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    What are the steps to reproduce this behavior?

    Are you able to reproduce this behavior in a new project with a simple scene?
     
  41. ducknet

    ducknet

    Joined:
    Feb 17, 2019
    Posts:
    1
    Here's what I discovered today which cost me HOURS of development time.
    If you change the text on a TMP UGUI component in runtime and then try to obtain the text data back from it, you get the string which was set in the inspector before you ran your game. I was hoping to have a typewriter effect for my character's dialogue but I don't think it'll be possible without using a separate string to hold the actual data it is displaying and avoid trying to pull it from the component itself.

    I am running standalone Windows 32 bit and I have seen this happen in two different places using the same type of component. (Standard 2D text). Very easy to reproduce. I filed a bug report too!

    What makes this particularly cumbersome is it doesn't happen in the editor player, only when you build your game.
     
    Last edited: Aug 27, 2019
  42. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    The TMP_Text.text property will always return whatever string was set on it. So if you do TMP_Text.text = "Some strings."; it will always return "Some strings.". If this property is changed via script, it will always return what it was last set to.

    How are you trying to implement this typewriter effect? Are you using maxVisibleCharacter like in the example "Old Computer Terminal"?


    By Standard 2D Text, what text component are you referring?

    Do you have the case # of that bug you submitted?
     
  43. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    203
    this happens in a medium sized project, I'll try to reduce it to the minimum possible to give you a repro project, but in the meantime as a workaround I was thinking to have a running script somewhere that detects when the webGL player goes fullscreen and gets all the TextMeshProUGUI objects in the scene and re-renders them, how could I do this part? I know there is a method called SetAllDirty() but it's not documented so I'm not sure if it is the correct way, theres another called Rebuild() too.
     
  44. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Being able to reproduce the issue is always key to figure out what is going on and to come up with the proper fix. It would be great if you could submit a bug report with the included project (or some smaller repro if easier) along with the steps to reproduce the issue.

    In terms of the issue, I am assuming it is graphic device related as going to fullscreen most likely affects the texture which don't get handled correctly in the switch.
     
    Cleverlie likes this.
  45. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    395
    I have found that TextMeshPro dont render on small z coordinate scale.
    While it is pointless because we use 2D FullScreen Overlay Canvas, scaling canvas in Z coordinate fixed my issue.

    I think this is some float precision hell because disappearing happens on different Z scale for PC and mobile
     
  46. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    How small was that Z scale?

    BTW with SDF, you want to keep the scale of the text object uniform.
     
  47. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    395
    I dont remember exactly.
    Uniform just dont work (Dont render)

    Default Canvas makes scale something like 0.001 + add it as WorldCamera and set camera VOF to something small

    Now it makes rectangular instead of disappear
    upload_2019-8-29_18-15-23.png

    Additionally in scene from far distance it looks wierd
    upload_2019-8-29_18-18-49.png

    Attached test scene setup

    All UI works normal only TextMesh Pro get ugly :)
     

    Attached Files:

  48. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    I does indeed look like some precision issue related to the clipping value set on the Camera and Canvas plane distance.

    The ghostly artifact around the text object is the result of the SDF scale not getting updated correctly as a result of changing the Plane Distance. This is due to the text object having no idea these values have been changed. Entering Playmode or doing anything that would result in the text object being updated will update the SDF Scale. Are you changing this Plane Distance at runtime or is this something you have observed in the Editor only?

    I would suggest looking at using some larger scales overall.
     
    Last edited: Sep 3, 2019
  49. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    395
    It is editor only and it hapend once and now all UIText in editor looks like this and it persists on entire working loop including editor version update.

    Unfortunately it can t be done just because we use 3d ui on GUN that drawn in from of player hands. And UI that drawn in Gun Scope scale of up to 45 which means FOV around 2.

    So for now TexMeshPro just not usable as text rendering solution for World UI for FPS Games with HUD UI and Scope scale :(
     
  50. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,331
    Do you frequently changes these two values?

    The issue is no callback related to when these values are changed. So the text object has no idea it needs to update the SDF Scale.

    If this change only happens in the Editor, would could create a simple Editor script that would call ForceMeshUpdate() on all text objects which would resolve this.

    In terms of the precision issue with the small clipping values, you have .09 on the Camera and .1 on the Canvas right?