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

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The implementation is simply designed to loop through the frames but this could be revised to add additional functionality. internally it uses a coroutine so if you have access to the source code version of TMP, you could tweak this.
     
  2. AquariuZ

    AquariuZ

    Joined:
    Jun 15, 2013
    Posts:
    3
    HI, how about Cyrilic symbols
     
  3. bradbecker

    bradbecker

    Joined:
    Dec 26, 2014
    Posts:
    130
    OK, thanks -- ignore my dm. There are really two things I think would be really useful:

    1. Have control over stop / play
    2. Change loop points at runtime.

    It sounds like the right approach is to have the coroutine check externally adjustable variables on every iteration instead of passing them in as parameters. I have the source code and will take a look.

     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I presume you are asking about including Cyrillic characters in font assets. If so, the answer is Yes. As you create your font assets, you simply add the unicode range or the characters / symbols you wish to include.

    If you are not sure how to do this, please see the font asset creation video linked in the sticky post at the top of the "Unity UI & TextMesh Pro" section of the Unity forum.
     
  5. AquariuZ

    AquariuZ

    Joined:
    Jun 15, 2013
    Posts:
    3
    I watched the video. And now everything is good. Thank you very much!!!
     
    Stephan_B likes this.
  6. Tropobor

    Tropobor

    Joined:
    Mar 24, 2014
    Posts:
    73
    Hi Stephan,
    I've seen your video: "Short video showing a prototype for a UI.Image component working with SDF Shapes"
    I'm deeply interested with this feature, could you tell us when it will be available? Thanks
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    It is just a question of me finding the time to work on it. Currently I am focused on the new integrated / re-write of TMP so I don't have an estimate on when the UI.Image / SDF Shapes could become available.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
  9. zephyo

    zephyo

    Joined:
    Mar 28, 2016
    Posts:
    33
    Hi Stephan, thanks a lot for this asset! I was wondering, is there a way to get a version of TMP_Sub Mesh UI.cs without the physics/BoxCollider references, or purchase/access TMP source code somehow? The current TMP_Sub Mesh UI causes WebGL builds to include physics modules which I don't need.
    PS I looked all over for the answer to this and the closest was this thread: https://forum.unity3d.com/threads/questions-about-build-report-tool.437814/ but no solution. Thanks once again.
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Let me take a look as the sub text objects don't have any colliders on them so I am not sure why it would result in the inclusion / reference to the physics/BoxCollider in WebGL builds.
     
  11. zephyo

    zephyo

    Joined:
    Mar 28, 2016
    Posts:
    33
    Thanks!! I hope you find what's up!
     
  12. livingtarget

    livingtarget

    Joined:
    Apr 21, 2015
    Posts:
    83
    I noticed that TextMeshPro integration wasn't on the Unity road map any reason for that? Is it just too early to know how long it would take?
     
  13. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Too early to show up on the road map but that is my main focus.
     
  14. Trivium_Dev

    Trivium_Dev

    Joined:
    Aug 1, 2017
    Posts:
    78
    Hi Stephan, I'm having a small issue when trying to add the copyright symbol (\u00A9) into a textfield. It seems to work as long as the textfield has the symbol in it when runtime starts (as in, I put "\u00A9" into the textfield in the Unity Editor), however I need to be able to dynamically put that symbol into a textfield during runtime. When I do that (for instance, in code do myTextfield.text = "\\u00A9"; ), the characters just show up as those actual characters. However, if I clicked anything on the TextMesh Pro UGUI component (such as turn off and on "Enable Kerning"), the text updates to the actual symbol.

    I've tried messing with the "Override Tags", "Enable Rich Text", and "Parse Escape Characters" thinking turning one of them off (or some combination of them on and off) would fix the problem, but it hasn't. I've also tried, in code, toggling different things (such as "Enable Kerning") to see if that would fix it like it does in the Editor, but it doesn't. I've also tried calling ForceMeshUpdate(), SetAllDirty() and Rebuild() and none of those work.

    I can also delete the "9" and retype 9 to get it to update to the symbol. But otherwise it just shows "\u00A9". I'm hoping you can point me in the right direction, thanks!

    Edit: I noticed if in MonoDevlop I type "\u00A9" and then put the @ symbol in from to turn the string into a string literal, MonoDevlop converts the text to the symbol and then the textfield shows it as a symbol correctly. But the text strings I'm using are coming from an XML so I can't use the string literals with them. I also noticed if I type @"\u00A9"; it doesn't convert it to the symbol and the textfield doesn't show it correctly unless I make a change in the editor to get it to refresh or whatever is happening.
     
    Last edited: Sep 13, 2017
  15. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The behavior is the result of the different handling of those characters between a string and the editor. As you have notices, when you use \u00A9 in a string, C# converts it to the correct character. If you type the same thing in a public field (in the editor) Unity escapes it and as such you get a string literal or \u00A9 showing up. When the text comes from an XML file, it is also typically escape so the string ends up being \\u00A9.

    The reason it works with TextMesh Pro in the Text Input Box is because, TMP looks for these \u or \U and handles the parsing differently so we can use UTF16 or UTF32 characters.

    When the string comes from XML, you should be able to search and replace the double \\ or escape sequence for the string to work correctly.

    In terms of the Input Field, escape sequences are handled like the Unity editor does which doesn't allow escape sequences. This is something I need to revisit. I'll try to take a look later tonight.
     
  16. Trivium_Dev

    Trivium_Dev

    Joined:
    Aug 1, 2017
    Posts:
    78
    Thanks Stephan that led me on the right track - I ended up having to do myString.Replace("\\u00AE", "\u00AE"); which got it to work.
     
    Stephan_B likes this.
  17. MrScrumbles001

    MrScrumbles001

    Joined:
    Jun 7, 2013
    Posts:
    18
    Hi there!

    I am having an issue and I am wondering if you can help, but it may be out of your control.
    I am working on a github repo, and one of our branches is having an issue with TMP and we cant figure out the cause. It does not seem to have any impact on the build, but it seems to be making Unity unstable.

    We are getting this error every time a scene is loaded "FileNotFoundException: Could not load file or assembly 'TextMeshPro, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies."
    All text is loading correctly, but it seems to be causing crashes in the editor (as our other branch is stable).

    I have tried updating TMP pro, but that causes an error with all text (missing script on inspector). I have also tried copying the entire TMPro folder from the working branch, but it has no impact.

    Was wondering if you could point me in the direction of a fix, or a file that may be corrupt.

    Cheers.
     
  18. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Make sure that you are using the correct version of TMP for the version of Unity that you are using. If you are using the free version, the dll name should match the version of Unity. For instance the dll for Unity 2017.1 would be TextMeshPro-1.0.55.2017.1.0b12.

    If you are using the paid / source code version, make sure you remove the old version first before importing the new package. See the release / upgrade notes about this.

    Look into these two things and we can go from there.
     
  19. MrScrumbles001

    MrScrumbles001

    Joined:
    Jun 7, 2013
    Posts:
    18
    Cheers!

    I am on paid, will check what the other user is using.
     
  20. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Make sure you have / register on the TMP user forum and get the latest release for the version of Unity that you are using.
     
  21. MrScrumbles001

    MrScrumbles001

    Joined:
    Jun 7, 2013
    Posts:
    18
    Deleting the folder and re-importing fixed it.

    Cheers.
     
    Stephan_B likes this.
  22. Waz

    Waz

    Joined:
    May 1, 2010
    Posts:
    287
    I'm using fallback fonts such that I have a high resolution SDF for the Extended ASCII characters then a lower resolution SDF for the full Unicode range as fallback. However, it seems that many font material properties are resolution dependent:



    As you can see, the outline is thicker on the "ū" character, which is coming from the Unicode fallback font.

    Is there a scaling factor on the fallback or some other way that I can counter this?
     
  23. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    In order to attempt to preserve the visual appearance resulting from the use of Material Presets, the Fallback system (by default) creates an instance material for the fallback to use with matching material properties.

    As you have discovered, you can end up with pretty different visual appearances if the fallback font asset has a different Sampling Point Size and Padding value. Fortunately there is a solution for this :)

    As it turns out what matters here is not the Sampling Point Size or Padding but the Ratio of Sampling Point Size to Padding. For instance, if your Primary Font Asset has a Sampling Point Size of 100 and Padding value of 10, as long as your Fallbacks maintains this ratio like a Sampling Point Size of 50 with Padding of 5 or anything (int values) in between, you will get the same visual appearance in terms of outline thickness / shadows, etc. Although your fallback will be of lower or higher sampling quality and possibly using a different atlas texture size, other than sampling difference, it will look pretty much identical.

    The only drawback in this case, is having to regenerate your fallbacks to make sure they use the same ratios.

    BTW: Having TMP try to match Fallback Materials can be disabled in the TMP Settings file in the Fallback section.
     
  24. Deleted User

    Deleted User

    Guest

    Hi Stephan,
    Forgive me if this is answered elsewhere and my Google fu isn't up to scratch as I've seached all over including youtube to no avail.

    I'm trying to use Textmeshpro in a vr game in world space and am having trouble determining correct scale and size- the docs briefly mention it in a passing sentence, but don't give much info. So as I'm trying to make all my objects real-world size - so that it works for a person immersed in VR, I'll be making objects which have text on them at various sizes relative to a person. So if a person is 1.8m tall, some sign objects might be 200mm or 0.2m wide - a street billboard would be bigger. All text is generated in runtime so no way to premake these other than the template as a prefab.

    So my questions are:
    1) How do I size things? I mean the docs kind of indicate to make the canvas 800m x 600m and then use the scale of the canvas and then the Textmeshpro rect and then the font-size to go - but that seems weird and hard to manage. I mean if my canvas is (in the world) 0.2m w x 1.0m h then shouldn't I set the size of it to be that and keep scale at 1.0 for xyz? And then i size the Textmeshpro rects to be the real-world sizes of the fields on the sign or in-game poster - but then what does the font size get set to? At real world sizes having a 0.00045 font size is confusing - I'd rather be able to set font size in mm of capheight of what the person would read in game? Can you please elaborate on best sizing practices so my text object can matchnmy other world space props?

    2) and assuming I have a canvas for each sign or poster or UI element in world space - is this a problem if I have say dozens or hundreds of canvases each with different text on them? I mean this is not for mobile it's for a beefy VR system - so hopefully it will work? I intend to have prefabs with canvases and multiple Textmeshpro fields all formatted differently for layout and style on each, and then have a data feed generate these objects in game - at times at a high rate - can you forsee any performance issues or gotchas - any best practice ideas?

    3) Are there any tutorials or demos which show words or Textmeshpro field exploding apart by letters with physics? So a sign gets shot at the letter spray out and fall down from the paragraph? How tricky is this to do- can you add physics to individual letters?

    thanks!
     
  25. TheFlyvio

    TheFlyvio

    Joined:
    Jul 23, 2013
    Posts:
    15
    I am having an Issue in Android: apparently, text with underline are not showing. I am using the mobile/distance field shader. The first image is the windows version, and the second is the Android version.

    windows.jpeg android.jpeg
     
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What version of TMP are you using? The version number is part of the name of the TextMesh Pro dll located in the "TextMesh Pro/Plugins/..." folder.

    In terms of the images, I don't see any text at all in the 2nd image. Does that mean that you are using underline on all the text?

    Are you able to observe the same behavior in a new project and creating a simple text object which uses Underline?
     
  27. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I am not sure I would use the Canvas system and TextMeshProUGUI component for worldspace. Unless there was a reason for using the Canvas system, I would use the normal TextMeshPro component located in "Create - 3D Object - TextMeshPro - Text".

    In terms of scaling, I don't have any recommendations other than trying to use some logical scale like you are trying. The normal TMP text component is designed to replace the old TextMesh so it uses the same scaling which unfortunately different than the canvas system. The Camera settings also can affect scaling and obviously if you use the canvas system and canvas it also impacts scaling.

    I would make sure not to use crazy small point size and instead scale the objects. Ie. I tend to stick to 36 points as base size and scale the objects.

    There is an example somewhere in this or the other TMP thread. The trick to explode letters was to have a separate object for each letter. To do this, I changed the threshold that TMP uses to get around the 65K vertices limit. In this case, I forced TMP to create a sub text object per character. I then had a script that added a rigidbody and collider to each character. Unfortunately, without access to source code, you can't change the code to force this creating sub objects per letter.

    Alternatively, you could use the TextInfo class and data contained to create new geometry / objects for each character.

    Here is an example of what that old test looked like.
     
  28. TheBullet

    TheBullet

    Joined:
    Mar 1, 2016
    Posts:
    28
    Hello @Stephan_B , first of all I want to congratulate you for your work. I've been using Text Mesh Pro for a long time and it has been one of the best purchases I've ordered in the asset store!

    I'm having some problems with the text. In world space canvas, some letters disappear or become rectangles depending on their size and the position of the camera:


    In screen space canvas, when the screen resolution is very low, al the letters become rectangles.

    Do you know what might be causing this? Thank you.
     
  29. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Which version of TextMesh Pro and Unity are you using?

    If you just recently upgraded to a new version of Unity, this could be due to the "Additional Shader Channels" on the Canvas not being set correctly and also due to not using an updated version of TMP for that new release of Unity.

    There are a few other things but let's start with the above.
     
  30. TheBullet

    TheBullet

    Joined:
    Mar 1, 2016
    Posts:
    28
    I'm using an old version of TMPro with Unity 2017.1.0p4. Is 1.0.55.52.0b5 the version to which I have to update?
     
  31. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    TMP has a 1.0.55.2017.1.0b12 which you can get off the TMP forums. Since you've upgraded to 2017.1, you should grab this version (it's newer and it's designed for 2017.1).

    And I think the suggestion is to delete your old TMP folder before importing the new version.

    If you made any source code changes, make sure you keep track of it. :)
     
    Stephan_B likes this.
  32. TheBullet

    TheBullet

    Joined:
    Mar 1, 2016
    Posts:
    28
    Thank you. I just registered and I'm awaiting for admin approval.
     
  33. TheFlyvio

    TheFlyvio

    Joined:
    Jul 23, 2013
    Posts:
    15
    The cards on the bottom have "plain" text and are shown. I dont know if it is only the underline
    Version: vcomp120.dll
    The font is configured this way: (The render Queue is also changed to 4999 in the debug mode of tab)
    textmeshpro.PNG
     
  34. RiccardoAxed

    RiccardoAxed

    Joined:
    Aug 29, 2017
    Posts:
    119
    Hi,

    I guess it's a question already posed, but I need to localize an app in many languages - western languages plus Chinese - using the same font. Which are the right steps to add Chinese characters in a Text Mesh Pro font asset?

    I read some hints here and there, tried to use a fallback asset font, generating the Chinese set from a text file and other similar attempts, never having success. Usually the Font Asset Creator hangs indefinitely, some other times Unity simply crashes after a while.

    I would really appreciate a detailed, step-by-step guide, differently i'll have to give up and use the standard Text asset instead.

    Thanks,

    Riccardo
     
    Last edited: Sep 26, 2017
  35. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I approved the registration the came in overnight. Some registrations were missing or had incorrect invoice numbers so make sure you check your email in case you haven't been approved yet.
     
  36. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I presume you have the source code / paid version of TextMesh Pro. If so, the version number is found in the header of the TMP_Text.cs file.

    It is possible that changing the render queue can affect this but not certain. Could you submit a Unity bug report with a Repro so I can take a look? Make sure you post the case # for me.
     
  37. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The Font Asset Creator should not hang but depending on the number of characters, SDF mode, padding value, etc it could take a while to generate the font asset. Could you post an image of the settings your are using when creating this font asset?

    Can you provide me with the source text file and font file that you use to try to create the font asset? I will check to make sure all is ok.

    Once I have these things, I can provide you with a step by step as I help you get this created.
     
  38. TheBullet

    TheBullet

    Joined:
    Mar 1, 2016
    Posts:
    28
    I upgraded to the latest version and now works well. Thanks for your help.
     
  39. vpu

    vpu

    Joined:
    Mar 4, 2016
    Posts:
    2
    Hi,

    All components of TextMesh Pro in the version from Asset Store are in DLLs.
    But I'm using Unity with .git and CI. And it leads to issues with MonoBehaviour classes in DLLs and prefabs. Each time someone clones project (or I try to create a build on CI machine), he receives prefabs with missing references because scripts ids on each machine are different.
    I want to find a way how to use TextMesh Pro and the easiest way to do it is to get the source code.
    But I can't find any links to sources. And if it requires some payments I can't find where I could make payment to get this sources.
    Could you help me with it?

    Thanks,
    Vladimir
     
  40. remiverny

    remiverny

    Joined:
    Jul 3, 2017
    Posts:
    3
    Hi @Stephan_B !

    I have an issue I hope you could help me with. I added a font to our project for my company, which gives us a total of 4 fonts. However, it produced quite a few warnings that we didn't have before, such as "Kerning Key for [76] and [121] already exists." (80 times).

    Not knowing what it is about, I did some researches and couldn't find much. I also noticed that not a single one of the fonts we use has any kerning pair ! I'm quite confused. Could you give me some insight?

    Thanks a lot for all,
    Rémi
     
  41. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Make sure you are using the latest release of TMP as I did make changes over time related to this.

    When you created the new font assets, did you select / toggle the import kerning pairs?

    Warnings can be suppressed in the TMP Settings file.

    I would have to look at one of those fonts (that gives a warnings) to figure out why. The font could have duplicate kerning pairs. You can email me the font and the characters you are including in it (ie ASCII or Extended ASCII or some range).
     
  42. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    I'm currently trying to reduce the initial load time for an app I'm working on. The app is a book app, so it uses TMP heavily for a lot of things. At the start, the last page a user was on is generated. This text is generated from a file. Then the user has an option to "highlight" certain parts of the text, which creates the need to insert mark tags into the text. These highlights are saved out so when the user resumes the app, the text will appear again with all their highlights.

    However, this seems to have created an issue with the Array.Resize that is triggered when the highlights have to be drawn. Right now the string is created from a text file, then the "highlight" tags are inserted and the string is inserted into the TextMeshProUGUI.text to be displayed, but this is lagging our startup and creating a high amount of garbage it appears.

    I have included a screenshot from the profiler. With this in mind, how might I reduce this initial gc so the app loads faster?

    Thank you for your help.
     

    Attached Files:

  43. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just to make sure I understand correctly.

    1. You have an initial string with the raw text.
    2. You then do a bunch of string operations to this raw text to insert (I presume) the <mark> and </mark> tags.

    Step 2 would result in GC since are immutable and any modification to the string results in a new string.

    3. Are you inserting the tags in the raw text one at a time? For instance, if you are inserting 10 highlight regions, do you end up modifying that string 20 times to add the <mark> and then add the </mark> for each region?
     
  44. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    Actually, I'm using a stringbuilder. The tags are inserted, yes. The string is modified, and then assigned to the TextMeshProUGUI component. Further highlights aren't an issue, it's just the start up when a bunch of highlights exist.
     
  45. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    How many text objects are getting modified at startup?

    How many characters are contained in the source text?

    Each text object should only Array.Resize() once.

    P.S. Can you create a simple repro project for me to look at?
     
  46. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    I'll see what I can do on a repo. There are two textboxes in the scene that hold the main text. We are using two because the back textbox holds the highlights and the front holds the main text (gives the appearance of the highlights behind the text and not on top of it.

    We have a couple smaller TMP UGUI boxes in the scene as well, holds stuff like book title, page, chapter, that sort of thing.

    At most there are maybe 4 visible boxes (2 major, 2 with only a small amount of text) at start and then 3 more small boxes that are on inactive gameobjects. (these also have minor text). I do have other boxes, but I'm not in front of the project right now, and they shouldn't be getting populated at the start, but only if the proper menu is opened, but I am going to double check that.
     
  47. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    How many characters per text object?

    Once I get the repro project, I'll take a look to see what we can do here.
     
  48. remiverny

    remiverny

    Joined:
    Jul 3, 2017
    Posts:
    3
    Hi @Stephan_B !

    I'm truly amazed by the quality of your support for your asset. You're of great help !

    I'm using the quicksand-regular font mostly, with extended ASCIIas setting. Also, I do not have kerning ticked, nor did I import any kerning pairs. I can send it to you if you wish, though I'll need your mail adress.

    About the version we are working on, we did an update yesterday. What is the last version we can get ? And where can we get it ? Also, if it helps, we are working on Unity 2017.1.1p2.

    Once again, thanks a lot for the quick reply.

    Cheers,
    Rémi
     
    Last edited: Sep 28, 2017
  49. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The latest version of TMP is 1.0.55.xx.0b12.

    Are you using the free version or the source code / paid version of TMP?

    You can either PM and provide a link to the files or email Support@DigitalNativeStudios.com.
     
  50. remiverny

    remiverny

    Joined:
    Jul 3, 2017
    Posts:
    3
    We are on this version, and we are using the free version (there was already no more paid version at the time apparently). Email'd you the file, thanks a lot !
     
Thread Status:
Not open for further replies.