Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro Migrating from Legacy / Asset Store to Package Manager Releases

Discussion in 'UGUI & TextMesh Pro' started by Stephan_B, Jan 9, 2018.

  1. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Although it is recommended to follow Step 1, not doing so will result in a bunch of errors but those will be temporary.

    As it has always been the case when upgrading to a newer version of TextMesh Pro, you have to remove the previous version first by deleting the "TextMesh Pro" folder. As usual be sure to backup your project first and any files or assets you may have saved inside the "TextMesh Pro" folder. Once the previous version has been removed, then import the package version.

    If you imported the package version of TextMesh Pro prior to having removed the previous version, you'll get more errors but again these will be temporary until you remove the previous version. This may also require that you restart Unity as most likely to old DLL will have been loaded and cannot be unloaded without a restart. Again, these errors and wonky state is temporary.

    Once you have removed the old version, installed the package version and potentially restarted Unity, all these errors should be gone. You will then need to convert the project files to the new format using the "Project Files GUID Remapping tool".

    Upgrading from the older versions to the package manager version can be scary but once on the new package manager version, future updates will be much simpler as it will no longer require removing the old version first.

    Update
    Just tried again going from previous DLL version of TMP and importing without closing any open scene and without removing the previous version of TMP first and although you will get lots of errors. Once the previous version is removed and Unity restarted (which is required because the old dlls have been loaded), all errors went away and besides having to convert the project files, it all worked fine.
     
    Last edited: Jun 8, 2018
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    In which case does using < or > interfere with other libraries or require that you use <noparse>?

    BTW: you can reference "<" by using the UTF16 value which is \u003C and \u003E for ">".
     
  3. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    I'm parsing program source code that supports inline XML documentation, at the same time I add my own tags as markers for certain things. (like <1>, </1>, ...)

    Using \u003C \u003E works only when I manually toggle "Parse Escape Characters" off and then back on. The text doesn't change though, but ingame it does. I'll record a gif to show what I mean because that might be a little confusing.
     
  4. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Actually it always does that whenever the text is refreshed.


    All I'm doing in my code is setting the string using the SetText(string) method. I'll try toggling it off and on again in code.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I need to look into that behavior with SetText() as enabling or disabling Rich Text should not affect the \u or \U escape sequence.

    Having said that, I would recommend using the .text property. SetText() should only be used to combine short text with some variable to avoid GC or for Stringbuilder.
     
  6. eyeceepee

    eyeceepee

    Joined:
    Mar 9, 2017
    Posts:
    8
    Thanks Stephan, that's very kind (sure you've got a zillion other things to do!). I'm uploading now and will email the link when completed.
     
    Stephan_B likes this.
  7. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    I still can't understand how to fix it if I have already installed Unity 2018.1. I followed steps you describes in answer but nothing helped.
    I don't see any sense in Step1 - why that empty scene should be opened at all? Why not to close all Unity editors (I got multiple versions unity Unity HUB) and even if that MUST be opened, how can I do it reinstalling 2018.1... crazy
     
    Last edited: Jun 8, 2018
  8. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Can you explain the difference between .bounds and .textBounds and what they do exactly?

    I want to figure out if the cursor intersects a text by myself (meaning without IsRaycastTarget!),
    so what I'm doing is
    Text.textBounds.Contains(Input.mousePosition)
    but that doesn't work at all.

    textBounds and bounds seem to be relative (to their parent?)

    How do I get the correct bounds so I can test for intersection?
    Is there some other property somewhere? Or can textBounds be converted somehow?

    Edit:
    Figured it out, it's obvious in hindsight.
    Vertex coordinates are in local space and can be transformed with
    transform.TransformPoint(...)
    , just like with every other local / transform pair, nothing special about TMP (fortunately). :)
     
    Last edited: Jun 8, 2018
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Once Unity 2018.1 has been installed. Open Unity and create a new scene (this is done to close any scene that might have been open using TextMesh Pro).

    Then remove the previous version of TextMesh Pro in the project by deleting the "TextMesh Pro" folder. Again make sure you back up the project first.

    Then import the new version of TextMesh Pro using the Package Manager (Window - Package Manager) menu. Go to all and select TextMesh Pro 1.2.3.

    Assuming you didn't have any of the previous DLL's loaded, you should not be getting any errors. If so, restart Unity and they should be gone.

    Then go through the process of converting the project files as per the instruction in that first post.
     
  10. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    I did it 5 times already, nothing helped even with empty Unity 2018.1 project

    I just tried remove 2018.1.0 and install latest 2018.1.3 using Unity Hub, followed all steps and NOTHING works - TMPro namespace is still not available. Wtf..
     
    Last edited: Jun 9, 2018
  11. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    As per my previous message,

    Did you install TextMesh Pro version 1.2.3 using the Package Manager UI?
     
  12. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    Sure I did and after used Windows > TextMesh pro > Import resources
     
  13. doougles

    doougles

    Joined:
    Mar 30, 2015
    Posts:
    12
    Hi Stephan,

    Sadly, I never got the GUID Remapping Tool to work, so ended up just re-implementing all the TextMeshPro objects by hand over a couple days :-( Unfortunately, I can't feasible get you a copy of my project files.

    I do have one weird question for you, though:

    The bottom right of my screen is suck like this (Editor Mode and then Play Mode)
    upload_2018-6-9_21-41-2.png
    upload_2018-6-9_21-40-46.png

    It seems to be stuck this way permanently. I've never seen this before Unity 2018.

    I've never baked light in my life. In fact, my project is just audio + GUI.

    What I'm wondering is, is there any possibility this is some weird after-effect of the GUID Remapping Tool? I notice there are some visual similarities, so was just curious if you use that Unity bake GUI.

    The GUID Remapping Tool doesn't show a scan in progress, but still, given that the tool just didn't work for me, thought I'd ask.
     
  14. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you using Assembly Definitions for your own scripts?

    If so you will need to manually edit your .asmdefs to add a reference to the "Unity.TextMeshPro" assembly as per this post.

    Please note the name of the TMP assembly has changed to "Unity.TextMeshPro".
     
    Last edited: Jul 13, 2018
  15. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The GUID remapping tool looks for specific GUIDS and if it finds them it remaps them to the newly defined GUID. Ie. It doesn't touch anything else.

    I have also experienced strange reporting in that progress bar but not sure what causes it.
     
  16. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    Didn't understand any word here... Why and how should I modify these files?
    screenshot
    Don't you think there too many things to complete just to start using a single package out of the box? I can't access Unity.TextMeshPro namespace, it just doesn't exists, same as TMPro and other similar namespaces
     
  17. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    I'm assuming that means you are not a programmer (?) In that case I'll explain:

    .asmdef files are used to split the code of a project into multiple assemblies. That has many advantages that I won't explain here (google it).

    If you are using .asmdef files in your own code (google what they are and what they are used for),
    then your code will not be able to access the Unity.TextMeshPro classes and methods until you add the reference to it. And you do that by modifying your .asmdef file. No need to mess around with a text editor. Just click your asmdef in unity and it shows an UI.

    Here's an example of my project:


    There's literally nothing else to do.
    1) Install package 2) add tmp ref to assemblies that want to use it 3) there is no step 3 actually... haha

    GUID remapping is only needed when you want to upgrade your project anyway, so that's not something you'd have to do either to get things running "out of the box". It's just something for people who want to switch to a newer unity version with a project that's already underway.
     
    warrenra8 and gumbyscout like this.
  18. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    The thing is I do not use it. That's why I can't understand, why it's not possible to use package as it is just after import.
     
  19. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    did you try it in a completely new project?
    works without any problem here
     
  20. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    Yes, sure I did. I have found an option to remove VS related files but that didn't work as well. After that I changed script editor from Visual Studio for Mac to Visual Studio Code and that worked just fine - TMPro namespace become available.

    That's weird.. what could be wrong with editor
     
  21. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    That sounds like the solution generator code in Unity for VS is broken maybe.
    But it should still work if you'd use it, like with lots of red errors in vs, but then save anyway and switch to unity. That should make unity compile your scripts and then it should work, no? Can you try that, using VS and using it even if it is marked as not found, and see if unity can compile it anyway?

    VS "knows" what you can use based on the solution and project files.
    So maybe those are not generated correctly by Unity on mac?
    It's the only explanation I can think of, I mean if another editor thing works... hmm

    But doesn't VS Code also load the same kind of SLN and CSPROJ files?
    If they were really broken then the same problems should be appearing in VS Code.
    I never used Visual Studio Code, just the normal VS, so maybe it does things completely differently....
     
  22. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    515
    Yes it does
    That compiled, and been signed with "red" color where been used that namespace.

    I just reinstalled VS and seems now it works fine. Don't know what was that..
     
    Stephan_B likes this.
  23. Guirao

    Guirao

    Joined:
    Nov 24, 2012
    Posts:
    68
    The remapping tool scan is very very slow.
     
  24. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I can't find / get my hands on any projects that take longer than 5 minutes. If your project is super slow, please provide me with a sample / repro of the project so I can figure out why some projects take a much longer time to scan.
     
  25. Guirao

    Guirao

    Joined:
    Nov 24, 2012
    Posts:
    68
    I have around 28.000 files to scan. The first 1300 files are fast, 5 seconds, but then it takes ages. I reached 2.000 in an hour but I stopped it.

    Also I'm surprised that if I delete the text mesh pro package (the new one from unity) and keep my old free version the inspector of any text mesh pro editor breaks. I'm using 2018.2 b8
     
    Last edited: Jun 17, 2018
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Any chance you can submit a but report with your project?

    I would really like to make this process faster but I do need help getting my hands on one of those projects that take a while to convert. Projects can be provided to me via the bug reporter, private email, PM, etc.

    I do recommend migrating to the newer package version of TMP. I realize the conversion / scanning process is slow but this will only be necessary once.

    Assuming you want to try to keep running the older version, I just tested opening a project which contains version TextMesh Pro Release 1.2.2 - Unity 2017.3 in 2018.2.0b8.

    As soon as Unity is loaded, you get a lot of errors as a result of having the older version and the TMP UPM version present in the same project.

    The first step is to remove the TMP UPM package via the package manager UI.

    Once the package is removed, you will still have errors as a result of the DLL having been loaded. To clear these, you will need to restart Unity.

    Once Unity is restarted, the errors should all be gone and based on my testing, everything should be working as expected.
     
  27. Guirao

    Guirao

    Joined:
    Nov 24, 2012
    Posts:
    68
    I managed to delete a lot of files that i know for sure they don't have any dependency to textmesh, run the remapping and then recover the deleted files. However, there are some gameobjects that the text mesh ugui component is missing, some are fine, even in the same prefab.
     
  28. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Do you recall ever manually re-assigning any of the TMP scripts to some objects in the past due to object having missing references to these scripts?
     
    Last edited: Jun 18, 2018
  29. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    358
    Please make the Font Asset Creator window resizable. It doesn't fit in my screen resolution (1366x768). I don't understand why it should be so big and unresizable?
     

    Attached Files:

  30. Guirao

    Guirao

    Joined:
    Nov 24, 2012
    Posts:
    68
    No I don't remember doing that. Is there any way of fixing it without having to redo them again? I mean, I saw lots of ame objects with the script missing in the same prefab.

    Also it wold be nice that the remapping tool would let you choose specific folders to scan, the project can be huge and no need to scan fbx's or other files like that.
     
  31. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    It is realizable in the preview version 1.3.0.
     
    Laicasaane likes this.
  32. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    In the event that some of those objects were using an incorrect reference to the TMP scripts / DLL. Give the following a try.

    Attached is a zip file that contains two conversion data files to cover those additional GUIDs. In order to have the package use those, navigate to the package cache which on Windows is located in “C:\Users\UserName\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.textmeshpro@1.2.3” then replace the existing PackageConversionData.json and PackageConversionData_Assets.json by these two new files.

    Then run the GUID Remapping tool on the project you provided me and that should convert all the objects that it did not previously. Hopefully, I got everything so let me know how the conversion goes this time around.

    If these do not work. The best option would be to get a Repro of your project where I could figure out exactly why it is taking so long and how to address those files that are not getting converted correctly.
     

    Attached Files:

  33. Guirao

    Guirao

    Joined:
    Nov 24, 2012
    Posts:
    68
    Yes it worked!

    Although now Rotorz ReordableList is not compatible with 2018.2, oh dear...I'm gonna stick with 2018.1 in a while...
     
  34. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    The 1.3 package just throws all sorts of errors for me due to references in Examples & Extras

    Code (CSharp):
    1. (Filename: C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\VertexColorCycler.cs Line: 11)
    2.  
    3. C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\TeleType.cs(19,17): error CS0246: The type or namespace name 'TMP_Text' could not be found (are you missing a using directive or an assembly reference?)
    4. (Filename: C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\TeleType.cs Line: 19)
    5.  
    6. C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\Benchmark01_UGUI.cs(15,16): error CS0246: The type or namespace name 'TMP_FontAsset' could not be found (are you missing a using directive or an assembly reference?)
    7. (Filename: C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\Benchmark01_UGUI.cs Line: 15)
    8.  
    9. C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\SimpleScript.cs(11,17): error CS0246: The type or namespace name 'TextMeshPro' could not be found (are you missing a using directive or an assembly reference?)
    10. (Filename: C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\SimpleScript.cs Line: 11)
    11.  
    12. C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\TMP_TextEventHandler.cs(89,17): error CS0246: The type or namespace name 'TMP_Text' could not be found (are you missing a using directive or an assembly reference?)
    13. (Filename: C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\TMP_TextEventHandler.cs Line: 89)
    14.  
    15. C:\Users\tim\AppData\Local\Unity\cache\packages\staging-packages.unity.com\com.unity.textmeshpro@1.3.0\Examples & Extras\Scripts\VertexShakeA.cs(16,17): error CS0246: The type or namespace name 'TMP_Text' could not be found (are you missing a using directive or an assembly reference?)
    16.  
    + about 20 more

    This is in 18.b8

    -edit-

    downgraded? to the 1.3.0 preview version and it seems to work fine

    like the new look UI is nice
     
    Last edited: Jun 19, 2018
  35. Guirao

    Guirao

    Joined:
    Nov 24, 2012
    Posts:
    68
    The new look ui? Are you referring to the dpi feature they did on 2018.2?
     
  36. Checko

    Checko

    Joined:
    Oct 23, 2013
    Posts:
    17
    Hey All. Does anyone know if TMP supports Stylistic alts (salt) of a font? If so how do you access them? or is it possible to remap a character to its salt?
     
  37. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    TMP doesn't currently support OpenType font features which is how "salt" is implemented at the font level. Support for OpenType features is one of the new major features that will be supported in the new text system.

    In terms of adding a character to the font asset, you can do that in the Font Asset Creator using options like Custom Range Unicode Hex. Since most alternate form of characters are not assigned a unicode value, you might not be able to get access to those characters. You might have to use some font editing tool to simply assign a unicode to those glyphs.

    In terms of remapping, in the Font Asset Inspector, you can add new characters by using the Copy To some new hex unicode slot and then editing the values.

    upload_2018-6-20_10-11-18.png

    I am also working on improvements to the Font Asset Creator which will make it possible to actually raster any glyphs from a font file which will make this process much easier in the future.
     
    Checko likes this.
  38. locbui

    locbui

    Joined:
    Nov 4, 2013
    Posts:
    15
    Is there anyone have a problem with using TextMeshPro along with AssetBundles?

    I loaded a scene with TextMeshProUGUI, and all the text become "pink color"
     
  39. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Asset Bundles appear to be losing their reference to the material or even shaders. Once the bundle is loaded, you will have to re-assign the material and possibly shaders. See the following thread.
     
  40. EwieElektro

    EwieElektro

    Joined:
    Feb 22, 2016
    Posts:
    45
    I have another BIG Problem.

    I checked the remapper source Code to find out why my main Scene file is never showing in the file list.
    The Remapper Tool can't open my main scene file ( ~ 600 MB ), so there is absolut no conversion on this Scene file.
    This is the line from the remapper script:
    assetDataFile = File.ReadAllText(projectPath + "/" + assetFilePath);
    My main Scene was not open at this time.

    EDIT: I found out it's a outofmemory exception :(

    Any Ideas ?? :/
     
    Last edited: Jun 23, 2018
  41. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Any change you can provide me with a repro or submit a bug report with the project included so I can take a look at this?
     
  42. tswierkot

    tswierkot

    Joined:
    Feb 15, 2017
    Posts:
    25
    Is there a scripting symbol for TextMeshPro I can use to integrate it with my plugin?
     
  43. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    There is not.

    The ability to add global defines for packages is something that is being discussed.

    I used to add the "TMP_PRESENT" in OnInitializeOnLoad but I never felt that was a clean solution so ended up removing it.
     
  44. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    760
    Keep getting a console error when using the Package Manager version of TMP.
    This is in a new project using 2018.1, whilst everything still works this error keeps getting in the way. I can get it to go away by adding that font/ folder structure to the project - but we don't want it in the project.
     

    Attached Files:

  45. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This is pretty strange as "LiberationSans.ttf" is not a font asset. It is a source font file of type <Font>. Something is trying to load this but that would not be part of the TextMesh Pro package nor part of the examples.

    Perhaps some template?

    Try in a new empty project. Make sure you do not use any templates.
     
  46. adbourdages

    adbourdages

    Joined:
    Jul 8, 2012
    Posts:
    75
    Hey Stéphane,

    I've just upgraded TMPro to the Package Manager version within 2018.1. The whole thing went completely smoothly. I wanted to say thanks for providing such a nice upgrade mechanism and instructions.

    Alain-Daniel
     
    Stephan_B likes this.
  47. DocMcShot

    DocMcShot

    Joined:
    Mar 18, 2014
    Posts:
    14
    I've followed the steps and I don't have any errors. However, my scripts no longer like my "using TMPro;" directive. Is there a new namespace that I need to use? If not, how do I now access the TextMeshProUGUI ui text components via script? Thanks in advance for any help.
     
  48. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    See the following post about half way up this page as well as subsequent posts as the issue could also be Visual Studio related.
     
  49. Robbie4bes

    Robbie4bes

    Joined:
    Feb 21, 2017
    Posts:
    2
    So far I've tried this process for 2018.2 because I was using the Text Mesh Pro plugin for 2018.1 and never ran into any errors or problems. With 2018.2 I have the problem of errors based on there being 2 Text Mesh Pros (Plugin and Unity Package). Following the process listed above I get through Project Files GUID Remapping (after it informs me I need to change Asset Serialization from Mixed to Force Text before it can do the scan) but the areas where I was using Text Mesh Pro from the Plugin are left as "Missing" at the end of the process. Is there possibly something I am doing incorrectly within the described process? I don't want to end up having to manually replace every Text Mesh Pro in my Unity Project.
     
  50. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just to make sure I understand correctly, you are saying that after the remapping tool is done scanning and converting the files over, you still end up with some text objects with missing script references (ie. they didn't get converted)?

    If so, do you recall ever having to manually re-assign scripts to these objects in the past? If that is the case, take a look at the following post and included GUID conversion files.