Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Any time a developer like Unity, you or I make changes to a public API which others rely on, it requires those using such API functionality to make changes on their end to adapt.

    I always dread API changes because they are a pain to deal with. On the other hand often these changes are for the better so I just deal with it. It is more work for me but there is no way around it.

    So when Unity replaces or changes a function which is used by TextMesh Pro there is no way around having to get an updated release to address this change.

    So the issues you report are a combination of API changes (which require a new version of TextMesh Pro). Other issues like the RectTransform in Awake is the result of a bug in Unity which has been addressed in the latest Unity 5.6 patch but still making its way to Unity 5.5. There is another issue in 5.6 and 2017.1 where we can't use onPreRender which is also getting fixed by Unity but not available yet.

    I have uploaded new versions of TextMesh Pro to the Asset Store to circumvent some of those issue like the onPreRender. I also have a temporary work around for the RectTransform Awake limitation. These new releases should be available with the next few days on the Asset Store.

    If you send me a PM with your email address (any of you) I can get you this release via email. Please be sure to specify which version of Unity you are using.
     
  2. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    869
    Hello, I dont know how to send a PM, I dont see private message anywhere. i click on your name but it dont say send message or anything like that.

    Can you let me know how to do that?

    Thanks
     
  3. GuitarBro

    GuitarBro

    Joined:
    Oct 9, 2014
    Posts:
    179
    @Stephan_B First off, I would like to say a quick thanks for making such an awesome extension for Unity! Seriously, TMP is great. :D

    However, I was just recently working on a dialogue system using TMP's page wrapping feature and I realized I needed to know the number of characters visible in the current page and the number of characters previously to set maxVisibleCharacters accordingly for that page (I'm essentially extending the functionality of the TeleType example to be used across multiple pages for long dialogues). It seems that textInfo.characterCount returns the total number of characters and that maxVisibleCharacters takes into account previous pages' characters as well.

    Is there a way to do this already and I'm just oblivious?

    Thanks,
    GuitarBro


    EDIT: Scratch that, I'm just oblivious. The answer was textInfo.pageInfo[].lastCharacterIndex all along!
     
    Last edited: May 24, 2017
  4. Deleted User

    Deleted User

    Guest

    Hi,
    We are implementing chatting in our project. With TMP's inline sprites we have got the extra feature of showing emoticons. We are using a content size fitter and horizontal layout group to get the UI image containing TMP resize with text. Thought the problem we are facing is that with emoticons the content size fitter doesn't work anymore.
    Is there any workaround? Thanks in advance

    Thanks
     
  5. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    869
    How can I get more emojicons with TextMesh Pro? it only comes with a few.

    Thanks!
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    What version of TextMesh Pro are you using. A New release of TMP should be available on the Asset Store within the next few days, It has already been uploaded and just waiting in the review queue.
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Just take a look at the Sprite Asset Creation video which explains how to create Sprite Assets. Next you simply need to assign a Unicode value to the sprites which matches their Unicode which are all UTF 32 based and available on the Unicode.org website.
     
  8. M0rph3v5

    M0rph3v5

    Joined:
    Aug 15, 2012
    Posts:
    24
    Is it possible to add an outline to a bitmap font in the atlas or after with settings? It's weird that it doesn't seem to be supported, for all the pixelart games out there.
     
  9. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    The ability to dynamically style the text to add Outline, Shadow, Bevel, Glow, etc. is a side benefit of using SDF Font Assets. Unfortunately, this is not possible with bitmap fonts.
     
  10. M0rph3v5

    M0rph3v5

    Joined:
    Aug 15, 2012
    Posts:
    24
    I don't care if they're baked in the font texture though, but it seems I'm not able to do that since they're being used as masks?
     
  11. Souk21

    Souk21

    Joined:
    Dec 28, 2014
    Posts:
    14
    Hello,
    Is it possible to mask/crop a 3D TextMeshPro object ?
    Unfortunately, in this case I can't use UI Masking.
    Thanks a lot !

    edit: I figured how to do it with the ClipRect property, but is this the only way? Seems a bit overkill to have one material per text masked. (I have several texts with the same font that need to be masked simultaneously but differently)
     
    Last edited: May 23, 2017
  12. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    869
    I know its asking too much, but Is animated emoji possible with TextMesh Pro?

    Maybe you guys should come out with a paid asset package that has way more enojicons plus animation, i would buy that 100%
     
  13. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Take a look at Example 19 where a texture can be used to define a shape to mask the text.

    I also posted a shader with does WS masking in this thread or the other TextMesh Pro thread which could be of interest to you.

    Let me know if any of these work for you.
     
  14. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Yes. TextMesh Pro does provide the ability to use animated sprites. Use the <sprite="Sprite Asset Name" anim="first frame, last frame, frame rate">.

    Let's hope some asset store publisher reads this thread and takes you up on this request :)
     
  15. Tbjang

    Tbjang

    Joined:
    May 30, 2016
    Posts:
    1
    I'm testing textmesh pro free version in unity 5.6.1. I found the artifacts like uploaded files.
    Can I know why this happens and how this can be solved?
     

    Attached Files:

  16. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Check if the "Additional Shader Channels" TexCoord1, Normal and Tangents are enabled on the Canvas. If they are not, you are possibly using the version of TextMesh Pro for Unity 5.5 instead of 5.6. There is a new version of TextMesh Pro 1.0.55.0b9 where the name of the TextMesh Pro DLL indicates what version of Unity it is designed for. If you are not using the latest release, please get that one and let me know if the DLL does include something like 1.0.55.56.0b9 in its name.
     
  17. M0rph3v5

    M0rph3v5

    Joined:
    Aug 15, 2012
    Posts:
    24
    when the setting under FallBack Font Assets 'match material presets' is enabled and I'm using a bitmap font it's starts erroring about materials not being on the shader like 'OutlineWidth' even though those aren't even part of the bitmap shader at all..
     
  18. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    I'll take a look at this. Since "Match Material Presets" is only really valid for SDF Font Assets, I'll need to make some changes there.

    Thank you for reporting this.
     
  19. M0rph3v5

    M0rph3v5

    Joined:
    Aug 15, 2012
    Posts:
    24
    Is it possible to gain the source or a quick fix for this? We're pushing against release soon and this would save a whole lot of font hassle. Otherwise I need to create fallback fonts for every material setting type instead of just having the presets setup per font.

    EDIT: still happy to pay to access source if that is possible?
     
  20. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Just to help me understand, I guess you are using a potential mixture of SDF Font Assets and Bitmap Font Assets where in one case you want the Matching of Material Presets but not in the other. Correct?

    With regards to source access, unfortunately the asset is not available for purchase anyone. It is available to Unity users who have access to Unity source. Having said that, I suggest you contact your Unity sales rep.

    On my end, I will be back from Europe this weekend and can look to quickly address the issue and get you a new DLL. Can you please send me a PM with your email address and quick reminder note and Unity version you use and I'll get you are revised DLL.
     
  21. M0rph3v5

    M0rph3v5

    Joined:
    Aug 15, 2012
    Posts:
    24
    PM'd ya.

    To be specific about the problem:

    I'm using the latest unity 5.6.1p1 en latest textmesh pro (1.0.55.0b9), I've setup different font assets because localisation (one for english, one for japanese). I've setup the japanese font as backup for the english one. By default I'm just using a mobile bitmap shader, and another material preset with a custom bitmap shader for shadows.

    What I want to achieve is setup exact the same presets for my main and japanese font (material preset wise) and have the english with the shadow material preset selected fallback to the japanese with the shadow material preset. It can be as simple as it pointing to the same material preset index or something. If this is not possible I have to duplicate all the fonts and assign their material there, and then setup all those fallbacks one on one. Which is a hell whenever I need to change the font atlas. If that makes sense.

    Thanks
     
  22. ValeColombo

    ValeColombo

    Joined:
    Feb 21, 2017
    Posts:
    1

    Hi, i'm having the same problem. I'm using Unity 5.5.3 and when i updated TMPro I started getting the TypeLoadException error.
    I tried logging out, closing and logging in, but the problem persists.. Could yo send me the 5.5 package, please?
     
  23. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    What is the name of the TextMeshPro DLL located in "TextMesh Pro/Plugins/..."
     
  24. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    After updating to 1.0.55.0b8, I can't add any scripting define symbols to the project. Anything I add after "TMP_PRESENT" automatically gets removed. This also is happening in the latest release, b9.

    This is particularly bad in my case, as I need certain define symbols in order for my project to compile.
     
    Last edited: May 24, 2017
  25. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    The code that was adding defines has been removed in b9 so make sure when you updated to b9 that you removed the previous package before importing the new one.
     
  26. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    Thank you! That did the trick.
     
  27. StridingDragon

    StridingDragon

    Joined:
    Jan 16, 2013
    Posts:
    78
    Is it possible in TextMesh Pro to use the Color Gradient option to somehow put the gradient across an entire text block, as opposed to having it applied to each letter individually?
     
  28. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    I would use the normal Distance Field shader and use a texture on the face of the text and set the Horizontal / Vertical mapping options on the text object to line / line.
     
    StridingDragon likes this.
  29. StridingDragon

    StridingDragon

    Joined:
    Jan 16, 2013
    Posts:
    78
    Perfect! That worked. :) Thank you so much!!!
     
  30. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,069
    Hi, can I place TextMesh pro surface shader in a canvas windows? or I should place it directly in front of camera?
     
  31. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    The Surface Shader is designed to have scene lights affect the text object. This will only work with a Canvas set to ScreenSpace or WorldSpace.
     
    ksam2 likes this.
  32. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,069
    Thanks, I don't need any lights on my text I just want it to get effect by camera image effects, should I still use surface shader?

    Also is there any fade in/out effects for TextMesh pro?
     
    Last edited: May 25, 2017
  33. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Most screen FX don't work with transparent objects which text is due to the fact they are rendered in a different pass. You will need to experiment and tests those FX individually.

    In terms of fading text, there are several examples on the TextMesh Pro user forum along with script. See this post http://digitalnativestudios.com/forum/index.php?topic=1182.msg8986#msg8986

    Make sure you look through the example included with TextMesh Pro and scripts in the examples folder as well.
     
  34. xcube

    xcube

    Joined:
    Nov 27, 2011
    Posts:
    45
    Hi
    What steps do I need to do to update the version of TextMeshPro 1.0.54> TextMeshPro 1.0.55?

    I tried to remove completely the old version and install the new one, but it leads to the loss of components.

    Is there a way to avoid this?
    Thank you
     
  35. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    869
    Stephan_B

    You said earlier that Textmesh Pro can do animated emojicons, here is what you wrote....


    "Yes. TextMesh Pro does provide the ability to use animated sprites. Use the <sprite="Sprite Asset Name" anim="first frame, last frame, frame rate">."


    Above you just gave a generic way of how to do it, but can you give a specific example how to do it using an actual emojicon that is included with TextMesh pro? Something that i can just copy from here and paste into TextMesh pro and see it animate an emojicon that is included with TextMesh Pro?

    Thanks
     
  36. ToroSheep

    ToroSheep

    Joined:
    Aug 7, 2014
    Posts:
    3
    @xcube

    try steps :
    (1) Open Unity.
    (2) Log out of your Unity ID account.
    (3) Delete the "TextMesh Pro" folder.
    (4) Close Unity.
    (5) Delete TextMesh Pro Package download in Users\AppData\Roaming\Unity
    (6) Open Unity again
    (7) Log in to your Unity ID account.
    (8) Import TextMesh Pro from the Asset Store.
     
    Last edited: May 26, 2017
    Nonym likes this.
  37. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    <sprite anim="0,15,10">

    You simply need to create a sprite asset that contains your sequenced sprites and order them in the Sprite Asset Inspector.
     
  38. xcube

    xcube

    Joined:
    Nov 27, 2011
    Posts:
    45
    I tried to do everything exactly step by step. The result was exactly the same (

    Do I understand correctly that I now have only two options:
    1.to stay with the old version of TextMesh Pro 1.0.54
    2.To re-configure all the texts in my project manually.

    If there are any other options tell me, I would be very grateful.
     
  39. Nonym

    Nonym

    Joined:
    Oct 18, 2014
    Posts:
    49
    I had the same problem.
    I did it the @xcube 's way.
    (thx to xcube :D)
    Unfortunately, all of the TextMeshPro components in scene need to be re-configured.
     
  40. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    As I have mentioned in several posts, if you run into this issue, please send me a Private Message (Conversation) on the Unity forum an include your email address, the name of the TextMeshPro dll found in "TextMesh Pro/Plugins/..." and the version of Unity would want this release for.

    Once I get your PM, I will gladly email you the latest release.

    I am hoping that Asset Store team will fix this issue as soon as possible as it is a pain for all of us to deal with. My apologies for the inconvenience.
     
    xcube likes this.
  41. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    upload_2017-5-30_8-29-2.png

    Hello. I have a problem. I set text value to text mesh pro when text mesh pro recttransform sizedelta has not yet been calculated, text value is invisible. This situation arises for example when text mesh pro was unactive, it's anchor preset upload_2017-5-30_8-33-59.png
    . I make it active and set text value to it (In this example text mesh pro is inside horizontal layout). In this moment text mesh pro size is unknown
    upload_2017-5-30_8-38-8.png
    So text mesh will not display text value. Help, please.
     
  42. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    The Text object is processed late in the update cycle just before the camera is rendered. As such preferred values will not be updated until such time.

    When you need the text object to be generated sooner, you can use the ForceMeshUpdate() function.
     
  43. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Thank you! It works :)
     
  44. ramon_delmondo

    ramon_delmondo

    Joined:
    Aug 19, 2015
    Posts:
    22
    Hi
    I'm using TextMeshPro in my project and I'm trying to do this:
    https://forum.unity3d.com/threads/h...characters-above-characters-in-a-text.387772/

    I created a custom style:


    Before play in editor:



    After play:

    And I get this error:
    Code (CSharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. TMPro.TMP_Text.ReplaceClosingStyleTag (System.String& sourceText, Int32 srcIndex, System.Int32[]& charBuffer, System.Int32& writeIndex)
    3. TMPro.TMP_Text.StringToCharArray (System.String sourceText, System.Int32[]& charBuffer)
    4. TMPro.TMP_Text.ParseInputText ()
    5. TMPro.TextMeshProUGUI.OnPreRenderCanvas ()
    6. TMPro.TextMeshProUGUI.Rebuild (CanvasUpdate update)
    7. UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:149)
    8. UnityEngine.Canvas:SendWillRenderCanvases()
    9.  
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.TMP_Text.ValidateHtmlTag (System.Int32[] chars, Int32 startIndex, System.Int32& endIndex)
    3. TMPro.TMP_Text.CalculatePreferredValues (Single defaultFontSize, Vector2 marginSize, Boolean ignoreTextAutoSizing)
    4. TMPro.TMP_Text.GetPreferredWidth ()
    5. TMPro.TMP_Text.get_preferredWidth ()
    6. UnityEditor.Events.LayoutPropertiesPreview.<OnPreviewGUI>m__2 (ILayoutElement e) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/LayoutPropertiesPreview.cs:96)
    7. UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func`2 property, Single defaultValue, ILayoutElement& source) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutUtility.cs:86)
    8. UnityEditor.Events.LayoutPropertiesPreview.OnPreviewGUI (Rect r, UnityEngine.GUIStyle background) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/LayoutPropertiesPreview.cs:96)
    9. UnityEditor.ObjectPreview.OnInteractivePreviewGUI (Rect r, UnityEngine.GUIStyle background) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:112)
    10. UnityEditor.ObjectPreview.DrawPreview (IPreviewable defaultPreview, Rect previewArea, UnityEngine.Object[] targets) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:222)
    11. UnityEditor.ObjectPreview.DrawPreview (Rect previewArea) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:126)
    12. UnityEditor.InspectorWindow.DrawPreviewAndLabels () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:754)
    13. UnityEditor.InspectorWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:394)
    14. 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)
    Someone can help me?
     
    Last edited: May 31, 2017
  45. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Can you provide me with a minimal repro project that would enable me to reproduce the error?
     
  46. ramon_delmondo

    ramon_delmondo

    Joined:
    Aug 19, 2015
    Posts:
    22
    Last edited: May 31, 2017
  47. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
  48. M0rph3v5

    M0rph3v5

    Joined:
    Aug 15, 2012
    Posts:
    24
    @Stephan_B did you have any time to look at my problem, haven't heard back. Pm'd you my mail adress etc.
     
  49. cameron_oltmann

    cameron_oltmann

    Joined:
    Jun 7, 2017
    Posts:
    8
    I'm running into the following exception while trying to use the VertexJitter example on a TMPro_Text object that's disabled on Start (but enabled well before this call is made). Please ignore the line number, as I've modified VertexJitter:


    Thanks to the debugger I've found a clue as to the cause. It looks like CopyMeshInfoVertexData() is throwing the null reference exception due to an issue with m_CachedMeshInfo. m_CachedMeshInfo is the same length (1) as meshInfo, but all the fields in its first TMP_MeshInfo object are null. As a result the if (flag) block gets skipped, which means the cached info isn't updated, and the method fails when it attempts to operate on a bunch of null data. I don't have the source code version of TextMesh Pro available at work, so that's about as far as I can conveniently trace it. Please let me know if you need any additional info in order to hunt this issue down.

    Thanks!
     
  50. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Since the text is processed late in the update cycle (in onPreRender), it is likely that an attempt to access the data is happening before the generation of the text / data.

    After re-enabling the text object, you might want to use .ForceMeshUpdate() to trigger the object regeneration.
     
Thread Status:
Not open for further replies.