Search Unity

Text Mesh Pro - The Ultimate Text Solution for Unity - Powerful & Flexible - Advanced Text Rendering

Discussion in 'Assets and Asset Store' started by Stephan-B, May 29, 2014.

Thread Status:
Not open for further replies.
  1. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    @Stephan-B Should a TextMeshPro object always have a canvas Renderer and Mesh filter component? I'm not using the TextMeshPro UI component, just the regular one. When I make the object a prefab, unity automatically adds a canvas renderer and mesh filter, and won't let me remove them. I don't remember this happening before. (recently updated to unity 5.5.2).
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Including all the characters from a font when you might be using a small subset of them is wasteful.

    You will need to create a Primary SDF Font Asset and associated Fallback Font Assets per language or groups of languages as described in the following post http://digitalnativestudios.com/forum/index.php?topic=1319.msg9872#msg9872

    Although creating your font assets requires more work up front, it is the most efficient way of handling this from a run time performance point of view as well as ensuring that your fonts and material presets will look exactly as you want them.
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Yes. You will be using the normal TextMesh Pro component to replace the NGUI Label. You will also need to use the modified world space shader from the post above.

    The following post on the TMP user forum also contains a script at the end which should automatically handling the clipping (although I have not looked at this script in a while) .
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Since both TMP objects inherit from Graphic, they are forced to have those components. When using the normal TextMeshPro component found in 3D Object - TextMesh Pro - Text, it will still have a hidden Canvas Renderer but it isn't being used so doesn't impact anything.

    The Mesh Filter is required to work with the Mesh Renderer.
     
  5. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Ok, great, thanks for clarifying. So just to double check- when I add a "TextMeshPro - Text" component in the inspector, a Canvas Renderer and Mesh Filter component are also added to the object but are hidden in the inspector? Is that why I don't usually see them, but when I make the object a prefab they appear?
     
  6. TechDeveloper

    TechDeveloper

    Joined:
    Sep 5, 2016
    Posts:
    75
    updated my 5.4 project to unity 5.5.2. I also updated TM Pro. Im getting these errors.

    Assets/Plugins/_TOOLS/TextMesh Pro/Scripts/TMP_Text.cs(2364,59): error CS0121: The call is ambiguous between the following methods or properties: `TMPro.TMPro_ExtensionMethods.CompareRGB(this UnityEngine.Color32, UnityEngine.Color32)' and `TMPro.TMPro_ExtensionMethods.CompareRGB(this UnityEngine.Color32, UnityEngine.Color32)'

    Assets/Plugins/_TOOLS/TextMesh Pro/Scripts/TMPro_UGUI_Private.cs(3103,64): error CS0121: The call is ambiguous between the following methods or properties: `TMPro.TMPro_ExtensionMethods.Multiply(this UnityEngine.Color32, UnityEngine.Color32)' and `TMPro.TMPro_ExtensionMethods.Multiply(this UnityEngine.Color32, UnityEngine.Color32)'
     
    AR_Eurekafe and Michieal like this.
  7. aigam

    aigam

    Joined:
    Dec 31, 2005
    Posts:
    170
    Hi!

    I have this error on a clean installation (only importing textmesh pro) on unity 5.4.5:

    Unhandled Exception: System.TypeLoadException: Could not load type 'TMPro.TMP_InputField' from assembly 'TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    Thanks
     
  8. M0rrigan

    M0rrigan

    Joined:
    May 29, 2015
    Posts:
    29
    Hello, I have noticed that the alpha of the shadow is not depending on the letters' alpha. For example, I am using the GameObject with shadows turn on. I have this into the box: <color=#C1000000> H</color>ello. The H character is not visible, but the shadow does. Is there a way to make the shadow per character depending on the letters alpha?
     
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    When upgrading to a different version of Unity or TextMesh Pro, you need to remove the previous version of TextMesh Pro first and then import the updated version of TextMesh Pro or the version appropriate for the version of Unity you are using. Also be sure to read the release notes which provides this information as well as other important information.
     
    Michieal likes this.
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Yes.
     
  11. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    I would suggest deleting the current "TextMesh Pro" package / folder and re-importing from the Asset Store. It is possible that you ran into some import issue.

    Please let me know how this turns out.
     
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just to make sure I understand, you are using one of the Surface version of the TMP shaders where the text / characters using the color tag with zero alpha are still casting a shadow in the scene?
     
  13. aigam

    aigam

    Joined:
    Dec 31, 2005
    Posts:
    170
    This totally works, thanks!
     
  14. M0rrigan

    M0rrigan

    Joined:
    May 29, 2015
    Posts:
    29
    Yes, exactly. I have uploaded a screenshot of the situation Screenshot 2017-03-22 09.57.18.png
     
  15. TechDeveloper

    TechDeveloper

    Joined:
    Sep 5, 2016
    Posts:
    75
    The problem is if I delete TM from my project when i reimport it all the components are broken. "missing mono script".
    I retried without deleting it and eventually it worked, however I then had issues Dotween. I had to update dotween and then I get errors relating to TM with Dotween. So I have no choice but to delete TM pro and lose all references and "missing mono script" issues.

    So now I have to choose to stick with Unity 5.4... or take a long time doing it all again. My project is a desktop game with many gigs of data so this sort of issues cost me a lot of time and therefore money. I really wish you would focus on stability instead of features.

    Years ago I had simular issues with TMP and Dotween. I remember spending many hours reimporting and deleting again and again and again .... until it eventually worked. I'm not looking forward to this process again. and all other issues with updating TM components.

    I seriously considering rebuilding my project in Unreal engine. I'm not sure this is all worth it... just so I dont have crappy fonts I have to deal with this.
     
    Michieal likes this.
  16. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Pretty sure it's somehow possible to write a simple program in c# that modifies all the .meta/prefab/scene files to update all the references.

    I'll check to see if something can be done about that :)

    Sure its not a good situation, but cheap "threats" like that only guarantee that people won't take you seriously.
    Obviously rebuilding everything in a different engine will take a ton of time, rewriting all your scripts, etc... so either you're not serious or your project isn't that big yet anyway...


    edit:
    From the "outside" it will be harder, but from inside unity we could easily write a thing that saves all the object paths/names to all component instances of a TMP object.
    A lot of reflection will be involved, but nobody gives a crap if an "conversion" operation that runs one time only takes 10seconds or maybe 20 because of reflection :p

    Things to look out for:
    all scenes + all prefabs + all the public or [Serializable] members of the tmp object, as well as all the serializable members on all other objects because they may contain a reference to a tmp component.

    We would gather all the information of all objects and their properties, save them to some file, then remove the old TMP installation, add the new one, then restore all the information based on the names and values we've saved.

    Would work for sure, I'm doing something vaguely similar for generating AnimationOverrideController assets.

    However I have no need to convert anything, just letting you guys know that it's possible and not even that hard to do it if you really want to :)
     
    Last edited: Mar 22, 2017
  17. TechDeveloper

    TechDeveloper

    Joined:
    Sep 5, 2016
    Posts:
    75
    It's better you learn what a threat is.
    Also it's better you dont speak for someone else. It was clear I was taking to Stephan_B and not you. Or are you steven? if not then you're confused and you better learn how to not get confused.

    ps theres no such thing as a cheap threat.
     
    Last edited: Mar 22, 2017
  18. TechDeveloper

    TechDeveloper

    Joined:
    Sep 5, 2016
    Posts:
    75
    @Stephan_B

    No need to waste your time with my issue. We have decided to close all projects using unity and start rebuilding in unreal engine.

    Good luck in your new job.
     
  19. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    I am using a fresh install of textmesh pro, just downloaded from the asset store, and unity 5.5.0f3.

    I am unable to set textmesh.text = "some text" at runtime via script. The component continues to display the original value. Maybe this is an issue related to recent updates in the package, and/or engine integration?

    *edit - further information:

    When I switch back to a standard unity Text component, it updates properly. Here is a sample of the code I'm using:

    Code (CSharp):
    1.         var tm = go.GetComponent<TextMesh>();
    2.         //var tm = go.GetComponent<Text>();
    3.         tm.text = "some text";
    4.         tm.color = new Color(1, 0, 0);
    5.  
    When using the TextMesh component, neither the .text nor the .color is changing anything, but no error is generated, and the TextMesh definitely exists in the scene and is being found by this code.
     
    Last edited: Mar 23, 2017
  20. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Unless that's a typo, if you're using a TextMeshPro component you don't want to use TextMesh (which is the built in component) to access it. You need to use TMP_Text. i.e.

    Code (CSharp):
    1. var tm = go.GetComponent<TMP_Text>();
     
  21. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    Not a typo, I didn't realize there was a class called TMP_Text. :)

    I was looking here: http://digitalnativestudios.com/textmeshpro/docs/, but didn't see any mention of it. I guess the docs are out of date, and I should have looked at the included examples instead.

    I've tested using TMP_Text and it's working fine now.

    Thanks for the tip @flashframe!
     
    Stephan_B and flashframe like this.
  22. M0rrigan

    M0rrigan

    Joined:
    May 29, 2015
    Posts:
    29
    @Stephan-B Any news for the alpha issue reported in my previous post?
     
  23. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Thanks it's help
     
  24. KumarBurela

    KumarBurela

    Joined:
    May 29, 2011
    Posts:
    23
    bump
     
  25. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    For whatever reasons, the Unity forum has not been notifying me of any of these replies... argh!

    I am not sure why you are getting these import errors. Thousands of people are using TextMesh Pro and have gone through the upgrade process many times always deleting the previous package first and then importing the new one without issues. Of course there have been random hickups here and there due strange asset corruption issue while downloading or decompressing but this has never been an issue.

    So there is something about how you are doing this (process wise) or in your project causing this. The easiest way for me to isolate issues is always to get a Repro project as I can then see exactly what the issue is and provide a solution. Just send me an email and we can figure this out.
     
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    I will look at this over the weekend.

    As per my previous post. I am sorry for not replying earlier. The Unity forum decided not to Alert me of any of these new posts. Argh!

    Update
    Clipping is used right now to define the shape of the shadow which doesn't make it possible to control the alpha. Since this implementation mirrors how Unity does it in their standard shader, I have reach out to the graphics folks to see if I could handle the shadow differently to get alpha support.
     
    Last edited: Mar 26, 2017
  27. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Last edited: Mar 25, 2017
  28. Balistic_penguin

    Balistic_penguin

    Joined:
    Jan 18, 2017
    Posts:
    107
    I just got the program for a small project I'm working on and I'm having a few issues...

    The first is that I can't edit the text from a script. I'm not sure how to do this but it's essential to my project.

    The second is that I can't import a font that I want to use. I've followed tutorials and whatnot but it just doesn't work, seemingly for no reason.

    If I could get help with either or both of these that would be fantastic, thanks!
     
  29. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Similar to how Unity's UI is contained in the UnityEngine.UI namespace, TextMesh Pro is contained in the TMPro namespace which will require you add this namespace as follows.

    Code (csharp):
    1. using TMPro;
    There are two TextMesh Pro components. Please see the FAQ Question 9 on the TextMesh Pro user forum.

    What is the font you are trying to import? What have you tried thus far?
     
  30. Scorr

    Scorr

    Joined:
    Jul 2, 2013
    Posts:
    73
    Default Textmeshes allow you to use <material> tags like this:

    We are <material=2>texturally</material> amused.

    An array of materials is passed into the meshRenderer.materials, where the index of the tag is the index of the array.

    I saw it's possible to use different material presets for a text, but is it possible to change materials mid-sentence like this (parsed dynamically at runtime)?
     
  31. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    It is possible to change font and material presets anywhere in the text. See the following documentation http://digitalnativestudios.com/textmeshpro/docs/rich-text/#font

    I suggest you take a look at the following videos which explains a lot of this functionality.

    Multi font support

    Multi font and FontAwesome
     
  32. Balistic_penguin

    Balistic_penguin

    Joined:
    Jan 18, 2017
    Posts:
    107
    Thanks for the help!

    It's a font called Carlson OS http://www.1001fonts.com/caslon-os-font.html

    I've already imported it to unity and it works fine with the built-in stuff, but it doesn't work with the Text Mesh component. I've tried to put it in the Font Asset Creator but the "Generate Font Atlas" button doesn't do anything, I click it and it's grayed in for a bit but nothing else happens.
     
  33. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    I just tested this font and it appears to be working fine. Here is an image with the settings I used to create the SDF Font Asset.

    upload_2017-3-26_14-20-27.png

    Please be sure to watch the Font Asset Creation video as well as the Working with Material Presets as well as these are two very important aspects of working with TextMesh Pro.
     
  34. Balistic_penguin

    Balistic_penguin

    Joined:
    Jan 18, 2017
    Posts:
    107
    If I try to do that nothing happens and it gives me this error message:

    DllNotFoundException: Assets/TextMesh Pro/Plugins/64 Bit Plugins/TMPro_Plugin.dll
    TMPro.EditorUtilities.TMPro_FontAssetCreatorWindow.DrawControls ()
    TMPro.EditorUtilities.TMPro_FontAssetCreatorWindow.OnGUI ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    (It doesn't work with any other font, either...)

    Thanks for getting back so quick, btw!
     
  35. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    That is most likely because you are on Windows but don't have the Visual C++ Redistributable Packages for Visual Studio. See Question 6 on the FAQ from the TextMesh Pro user forum.
     
  36. Scorr

    Scorr

    Joined:
    Jul 2, 2013
    Posts:
    73
    Thanks for the reply. It seems like it's required to use the SDF shaders and so you couldn't just apply a custom shader over the text, is that correct? Seems like I'll need to fall back to regular textmeshes if that's the case. :(
     
  37. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    You do have to use the custom TextMesh Pro shaders as they are designed specifically for SDF rendering and to support the dynamic visual styling and material presets.

    What type of shader were looking to apply to the text? What functionality were you seeking out of your shaders?
     
  38. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
  39. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Once TextMesh Pro (its functionality) is integrated into Unity, the requirement for this Visual C++ SDK will likely change.

    Having said that, since most users already have / use Visual Studio on Windows which includes this SDK, most users never have to install it separately. You are most likely running into this because you are on Windows and not using Visual Studio 2013, 2015 or 2017.
     
  40. Balistic_penguin

    Balistic_penguin

    Joined:
    Jan 18, 2017
    Posts:
    107
    I downloaded what you linked to but it's still not doing anything, do I have to do anything to the files I downloaded? Should I re-import the program?
     
  41. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Did you install the Visual C++ SDK?

    Delete the current "TextMesh Pro" folder and re-import the package again.

    What version of Windows and Unity are you running?
     
    Last edited: Mar 28, 2017
  42. oliran

    oliran

    Joined:
    Sep 29, 2015
    Posts:
    49
    Hi,

    For some reason, the background of the text is nontransparent as can be seen here: http://imgur.com/pVkx9PW

    After playing with every setting, the only way I found to fix it was to change Debug settings Scale X and Scale Y to 3, but then the borders look jagged. Any idea why this is happening and what else I can try?

    In case you need it, here is a screenshot of the settings: http://imgur.com/a/MCJfc

    Thank you!
     
  43. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The reason you are getting these visual artifacts is because the padding value based on the material settings you are using is too small.

    See FAQ Question 2 and Question 11 which explain why you are getting those visual artifacts.

    The Ratio of padding to sampling point size is important to understand when creating your SDF Font Assets as it control the effective range of the material properties. See the Font Asset Creation video which covers this topic.
     
  44. oliran

    oliran

    Joined:
    Sep 29, 2015
    Posts:
    49
    Thank you for the quick reply! I saw the video before, but I'm not sure it's the same problem. I set the padding to 30 but looks like it automatically gets reduced to 20. Width/Height are 2048. The point size is 288.
     
  45. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Are any of your material properties near their limits of 1.0? If you find yourself using values near the 1.0 maximum then it is a sign that your padding is too small. In this case, you have Dilation set to 1.0 where you are at the limit of the padding.

    Like I said, having to use values near their maximum is a sign that you need more padding or in the case of Dilation, you are trying to make that font much thicker than it is by design and thus could consider selecting a different font that is thicker.

    The padding value should not be changing. So if you set it to 30, it should remain at 30. A value of 30 is pretty large by the way. Although you are still about 10% in terms of Sampling point size to padding ration (288 / 30), I would suggest reducing that sampling point size / atlas texture. For instance, the LiberationSans has a sampling point size of 85. So you could half the sampling point size.
     
    Last edited: Mar 28, 2017
  46. NicoVar

    NicoVar

    Joined:
    Sep 21, 2012
    Posts:
    40
    Hi,

    I'm having a weird issue. When using a project on the Mac, if I build to Windows (both 32 and 64 bits), I get all TextMesh Pro meshes in pink with an error on the output log stating TextMeshPro/Distance Field has no vertex shader, followed by a "Shader unsupported" warning.

    However, if I transfer the whole Unity project to the same Windows machine, and open it up, all text meshes look fine and I can export and it works great.

    I've tried playing with the Windows Graphics API settings on the Mac (changing the order, adding OpenGL 2, etc). I've checked and the DLLs are being exported fine.

    Any ideas what may be causing the issue?

    Thanks!
     
  47. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    What version of Unity are you using?
     
  48. Scorr

    Scorr

    Joined:
    Jul 2, 2013
    Posts:
    73
    Right now we have several shaders for things such as wavy and rainbow text (example here: https://gfycat.com/SentimentalAcidicJabiru)

    Perhaps by figuring out how the SDF rendering works we could convert the shaders to support SDF rendering. However, even if we do that we'd be facing another problem: We're having trouble displaying pixel perfect text.

    Example:
    note the difference in width on the L's.

    The text has orthographic enabled and uses the TextMeshPro bitmap shader. We tried snapping the text's transform but it still seems to be a problem. Do you have any advice on how to deal with this, if possible?
     
  49. NicoVar

    NicoVar

    Joined:
    Sep 21, 2012
    Posts:
    40
    I'm using 5.5.2f1 on Mac OS 10.11.6 El Capitan.
     
  50. Balistic_penguin

    Balistic_penguin

    Joined:
    Jan 18, 2017
    Posts:
    107
Thread Status:
Not open for further replies.