Search Unity

TextMesh Pro Version 1.4.1-Preview 1 with Dynamic SDF for Unity 2018.3 now available!

Discussion in 'UGUI & TextMesh Pro' started by Stephan_B, Jan 31, 2019.

  1. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    See my previous post as I added more stuff...

    Since I did had options to hide both the mobile input field (line to enter text) and hide soft keyboard, perhaps we can change how the Custom Content type works.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I made the suggested changes where Generation Settings are disabled if the reference to the Source Font File is missing.

    In addition, if a font asset is set to Atlas Population Mode Static then all remaining Generation Settings options are disabled as seen below.

    upload_2019-5-12_15-55-35.png

    As usual, static font assets can be updated via the Font Asset Creator which can be accessed via the Update Atlas Texture option in the header of the font asset or Context Menu.

    Both of these changes will prevent users from accidentally changing / messing up static font assets.
     
    AcidArrow likes this.
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I looked at the alignment issue and it is caused by the given prefab having been created back in Unity 5.2 (ish) and never being updated since then. This prefab is using the old (Unity 4.x) text alignment enums.

    In version 1.3.0 of TMP, the old alignment conversion code was still present but removed with the introduction of the Dynamic system.

    I did reply to your bug report with similar details. Long story short, those prefabs need to be updated.
     
    dai50 likes this.
  4. dai50

    dai50

    Joined:
    Dec 27, 2018
    Posts:
    14
    Thank you!

    A question: The missing characters parameter in TryAddCharacters seems to get populated only with characters that could not be added because there was no space left in the font atlas, and not with characters missing from the source font. This behaviour is fine because it allows us to know if the altas is actually full or not, but just wanted to check if this is by design and should not change in the future?
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I need to review that as it should include both.

    P.S. With the Multi Atlas support feature coming in the next release 1.4.2 / 2.0.2, you won't have to worry about characters not fitting into an atlas. That is unless that feature is disabled.
     
    dai50 likes this.
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    @dai50 Just had a chance to verify the above and the returned missing character array will include both missing characters from the font file and those it was unable to fit in the atlas. However, it does not report those separately.
     
  7. dai50

    dai50

    Joined:
    Dec 27, 2018
    Posts:
    14
    Here is a sample scene. The last two characters in the string cannot be added to the font altas because they are missing from the source font, but it still doesn't return them as missing characters. Also noticed that TryAddCharacters also returns characters that already exist in the atlas.
     

    Attached Files:

  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The version I am using is 1.4.2 / 2.0.2 which hasn't been released yet which is why you it is behaving differently for you.
     
  9. GustavNinja

    GustavNinja

    Joined:
    Jun 13, 2016
    Posts:
    96
    Hi I’m working on a Japanese game we’re we have top to bottom text. I was wondering if there will be an implementation in the future like RTLEditor but for Top to bottom text.
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Nothing planned short term. Since you have access to the geometry of the generated text, I wonder if you could use the normal left to right layout and then use a matrix transform similar to the VertexJitter script to rotated the characters and re-position them vertically.

    This would not be accurate in the sense of vertical layout has its own metrics but you could also tweak the character / glyph metrics to achieve that as well. Sort of crude way but it could work until I get around to this.
     
  11. matiasticbits

    matiasticbits

    Joined:
    Jan 3, 2017
    Posts:
    30
    Is it possible to use Text Mesh Pro dynamic font using system provided font? We are using different fonts to support all the in game languages and we bake those to SDF based on the localization lines we have. But we are adding a clan feature that allows player to choose a clan name and type freely in the chat. This means we would like to have a support for pretty much all the glyphs possible and to make this happen we would need to use system provided fonts.

    Unity seems to support this in it's dynamic fonts: https://docs.unity3d.com/Manual/class-Font.html
     
    Last edited: Jun 10, 2019
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Trying to get this functionality in 2019.1 and hopefully in 2018.4.
     
  13. mdsitton

    mdsitton

    Joined:
    Jan 27, 2018
    Posts:
    66
    So I am attempting to build up a series of font assets at load time and populate them with characters, which seems to mostly work?

    Here is a stripped down version of the code with only the relevant TMP code: https://gist.github.com/mdsitton/13118a074f89565992aed406e14eda7e

    So a few questions, when doing this is it possible to lock this down creating it as AtlasPopulationMode.Static so that new characters cannot be added at runtime?

    Also how can i handle materials here, I need each of the 3 separate text objects to have their own styling. I notice that when creating a TMP_FontAsset at runtime it's forced to use the "TextMeshPro/Mobile/Distance Field" shader instead of the regular "TextMeshPro/Distance Field" which is used on assets made through the editor.

    What would be the best way to go about copying styling/material properties from an asset created and setup through the editor onto one setup at runtime?
     
  14. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Once the font asset has been created and the necessary characters added, you can set public AtlasPopulationMode atlasPopulationMode to static.

    When the new font asset is created, it includes a default material which references the atlas texture. You could change the shader assigned to this material or create a new instance of this material and then assign the appropriate shader to it and just like material presets, set the relevant properties on those materials to achieve the desired visual style.

    Make sure you reuse the same material instances on text objects that share the same visual style as opposed to creating new instances for each text objects.

    All the functionality you need to set the material properties is available via the material API as well as some utility class like ShaderUtilities which includes property IDs for the material properties. See this old post about this.
     
  15. mdsitton

    mdsitton

    Joined:
    Jan 27, 2018
    Posts:
    66
    Awesome thanks, i'll give that a shot.
     
  16. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    So upgrading to 2018.4.2 from 2018.4.1 seems to have auto-upgraded me from Textmesh Pro 1.3.0 to 1.4.1, which I didn't appreciate (is there any reason, or was it done by mistake?).

    Also, it seems like SDF32 generation with kerning is broken.

    I used SDF32 because on this specific font, it gave me marginally better quality (the e is smoother when really zoomed in), so I thought it was worth the one time extra generation time. But it seems kerning is completely broken:
    sdf32.jpg

    The SDFAA version is correct though.

    SDFAA has a AX of -9.4375 between T and e and SDF32 has -302.1719 (roughly 32 times bigger?)

    It's not specific to T and e, all AX numbers are false

    Disabling kerning "fixes" the issue, but... I want to use kerning :)
     
  17. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The signed distance field generation using the SDF16 and SDF32 algorithm is more accurate but much too slow for dynamic SDF generation. The SDFAA algorithm is less accurate but fast enough for dynamic use. The accuracy difference when displaying point sizes anywhere between 10 to about 90 is not noticeable since there are still not enough pixels to represent these inaccuracies. So for normal text the SDFAA works great but for large titles that are potentially heavily stylized, it would still make sense to use SDF16 or SDF32.

    In regards to the Kerning values, you are correct where the computed values fail to consider the up sampling of 16 or 32. I'll fix that.

    In terms of the auto upgrade of the package, I need to look into that as simply updating between 2018.4.x to a newer version of 2018.4 should not have done that.

    Update
    I just fixed the kerning values issue for the SDF8 / SDF16 and SDF32 modes. This fix will require a new version of Unity since the fix is contained in the FontEngine and not the TMP package itself.
     
    Last edited: Jun 17, 2019
  18. jason-vreps

    jason-vreps

    Joined:
    Sep 22, 2017
    Posts:
    16
    Our team is having an issue with the latest version of TMP (1.4.1). Our issue seems to be a very special case, and only shows up for our specific use-case with Unity Cloud Build. To be explicit, in our use case: Our app undergoes a light "re-branding" during the cloud build process to modify the same app for individual builds. During rebranding, some images are replaced, and fonts are changed (among other things).

    Our setup:
    • UI components are tagged with scripts indicating they should have an object (image, font, etc) replaced
    • Scriptable objects contain all the brand-specific identifiers (colors, links to images, font assets)
    • Each cloud build has some scripting defines. Based on the scripting defines, the relevant scriptable object is loaded in a pre-export method
    • Prior to each build, in a cloud build pre-export method, we iterate through each scene in the list, and each game object in the scene, replacing each tagged component
    • the build then completes, with all items re-configured for a given brand
    This setup worked great with TMP 1.3.0, but with 1.4.1 we are running into an issue that has completely hamstrung this process. When regular objects are passed (eg. images) they are replaced just fine. However, when FontAssets are sent, only null is received. After sprinkling debug traces through our pre-export process, we can verify that FontAssets generated with TMP 1.3.0 can be passed to each TextMeshProUGUI element for re-assignment, but FontAssets generated with TMP 1.4.1 are only received as null. Upon loading the scriptable object, the FontAsset can be verified to be non-null. It is only when passing the FontAsset as a method parameter does the reference get lost.

    We attempted
    • different versions of unity (2018.4, 2014.1)
    • reproducing the problem with a local build by using IPreProcessBuildWithReport, and all FontAssets are passed and replaced just fine
    • deleting and re-generating each FontAsset with 1.4.1 to ensure any meta references are current
    I'm at a loss for how to address this moving forward. The issue only arises when we use a Cloud Build pre-export process to re-assign a TextMeshProUGUI to a new FontAsset that was generated with TMP 1.4.1. Local builds and older versions of TMP do not appear to cause issues.
    Any ideas?
     
  19. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The only thing that I can think of that makes the 1.4.x font asset different than the 1.3.0 is the single Editor only serialized property. I am aware of a bug in our build system where this is miss handled. So I am curious to see if you remove the #if UNITY_EDITOR part of this to make this property serialized all the time if it will affect the behavior?
     
  20. jason-vreps

    jason-vreps

    Joined:
    Sep 22, 2017
    Posts:
    16
    Hi Stephan, thanks for your quick response. I have been having a heckuva time finding what might be different between the two FontAssets myself, so it's refreshing to hear your side. I'd love to try this fix, even as a curiosity. Could you point me more directly towards the preprocessor directive in question? I'll see if it can do anything. Thanks!
     
  21. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Take a look at the TMP_FontAsset.cs and just comment out the following:

    Code (csharp):
    1.  
    2. #if UNITY_EDITOR  // remove this
    3.         /// <summary>
    4.         /// Persistent reference to the source font file maintained in the editor.
    5.         /// </summary>
    6.         [SerializeField]
    7.         internal Font m_SourceFontFile_EditorRef;
    8. #endif /// and this ...
    9.  
    Just for testing to see if you will run into the same issue.

    P.S. Going to sleep ... will follow up tomorrow.
     
  22. jason-vreps

    jason-vreps

    Joined:
    Sep 22, 2017
    Posts:
    16
    Hi Stephan, I wasn't able to get the fix you recommended working, because we have our Library folder in the .gitignore. Since cloud build pulls from our git, it would've required pushing our entire library to git. I did manage to identify the source of our problem though. I'll describe it to you, and you can determine if this is an addressable bug, or by design.

    Our "rebrand" process occurs thusly:
    1. Initiate the pre-export method in Unity Cloud Build
    2. Identify the brand by checking our precompile defines
    3. load the appropriate Scriptable object by using
      AssetDatabase.LoadAssetAtPath()
    4. set our apps icons and some initial
      PlayerSettings
      values
    5. iterate over every scene in our build
      1. Load the scene
      2. iterate over every object in the scene using
        Scene.GetRootGameObjects()
      3. extract all our abstract rebranding scripts with
        gameObject.GetComponentsInChildren()
      4. iterate over each script, and call our
        Rebrand()
        method
    It's during step 5.4 that we are realizing null values are being passed to scripts when we were expecting a
    FontAsset
    . After heavy debug logging, I discovered that somehow between steps 5.1 and 5.2, these font assets were being deallocated in memory? It was literally right after the scene was loaded:

    Code (CSharp):
    1. EditorSceneManager.OpenScene(SceneUtility.GetScenePathByBuildIndex(i), OpenSceneMode.Additive);
    Once I found this issue source, I was able to get around it by simply re-loading our scriptable object (step 3.) after loading a scene. I was able to pinpoint the commits where our pre-export cloud build rebranding process worked, and where it stopped working, and the best I can narrow it down is the upgrade to TMP 1.4.1. So again, not sure if this is something you would define as a bug/undesired behaviour, but there we are.

    Thanks again for your attentive replies!
    J
     
  23. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Between version 1.30 and 1.4.x, the new Dynamic SDF system was introduced which required structural changes to font assets. As such, previously created font assets undergo some conversion when first access with the new release. This conversion process does affect the serialization, so it is possible that is the part / process causing all of this.

    I suspect all your font assets are based on version 1.3.0. I would be curious to see if newly created font assets in 1.4.1 would behave the same way.
     
  24. MadWatch

    MadWatch

    Joined:
    May 26, 2016
    Posts:
    112
    Hello

    I just switched to Unity 2018.4.2 and TextMeshPro was automatically upgraded from 1.3 to 1.4.

    With version 1.3 I made myself a script to generate all the fonts for my project. I made it by looking at the code of the Font Asset Creator Window and adapting it. Now I'm trying to do the same with version 1.4, but I can't. The reason is that many types and methods used by TextMeshPro's creator window are flagged as internal so I can't use them (for example TryPackGlyphsInAtlas() and GlyphLoadFlags).

    Would it be possible to make all these public so they can be called in user code ? Or is there a new and better way to generate fonts dynamically in the editor (not at runtime) ?

    Best Regards.
     
  25. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Font Assets can now be created at Runtime which also works in the Editor.

    Once a new font asset is created, you can use one of the variations of the TryAddCharacters() to add characters to the font asset.

    Dynamically created font assets are not persistent so you will need to handle that part in the Editor to make them persistent by simply saving them using the appropriate AssetDatabase functions.
     
  26. MadWatch

    MadWatch

    Joined:
    May 26, 2016
    Posts:
    112
    Thank you very much for the quick reply.

    Unfortunately I didn't manage to make it work. The font assets are saved but they don't have any material or texture within them (I assume they are not saved).

    Here is what I tried:
    Code (CSharp):
    1. // Load source font
    2. Font sourceFont = AssetDatabase.LoadAssetAtPath<Font>(sourceFontPath);
    3.  
    4. // Create a new font asset
    5. TMP_FontAsset fontAsset = TMP_FontAsset.CreateFontAsset(sourceFont, fontSize, characterPadding, GlyphRenderMode.SDF16, atlasWidth, atlasHeight, AtlasPopulationMode.Dynamic);
    6. // Add character to the font asset
    7. uint[] missingCharacters = null;
    8. if (!fontAsset.TryAddCharacters(charactersToBake, out missingCharacters))
    9. {
    10.   // If not all the characters where added
    11.   foreach (uint g in missingCharacters)
    12.     Debug.LogError($"Missing glyph {g:X4} '{(char)g}' into font {sourceFontName}");
    13. }
    14. // Make the font asset static
    15. fontAsset.atlasPopulationMode = AtlasPopulationMode.Static;
    16.  
    17. // Make it a persistent asset so it will be saved
    18. AssetDatabase.CreateAsset(fontAsset, outputFilePath);
    19.  
    20. // Save all modified assets
    21. AssetDatabase.SaveAssets();
    22. AssetDatabase.Refresh();
    23.  
    Edit :
    I made it work. Here are the lines I missed.
    Code (CSharp):
    1. // Add font material to asset so it will be saved
    2. fontAsset.material.name = outputFileName + " Material";
    3. AssetDatabase.AddObjectToAsset(fontAsset.material, fontAsset);
    4.  
    5. // Add font atlas to asset so it will be saved
    6. fontAsset.atlasTexture.name = outputFileName + " Atlas";
    7. AssetDatabase.AddObjectToAsset(fontAsset.atlasTexture, fontAsset);
     
    Last edited: Jul 2, 2019
  27. MadWatch

    MadWatch

    Joined:
    May 26, 2016
    Posts:
    112
    I'm running into a different problem now though. Whenever I try to use one of the font I generated with the above method into a Text Mesh Pro UGUI component I get a NullReferenceException from inside TextMeshPro's code (TMPro_UGUI_Private.cs:2029).

    Here is the full error.
    Screenshot 2019-07-02 at 15.38.11.png

    This does not happen with fonts that I generate using the Font Asset Creator window, so I must have missed something. Do you have any idea of what this error means ?

    Best Regards
     
  28. Sebioff

    Sebioff

    Joined:
    Dec 22, 2013
    Posts:
    218
    When switching from 1.3.0 to 1.4.1 text gets misaligned:

    It's placed on the pivot instead of being properly positioned inside the RectTransform (when moving the RectTransform pivot position the text moves with it).
    It doesn't happen in all places, only in some.
     
  29. Sebioff

    Sebioff

    Joined:
    Dec 22, 2013
    Posts:
    218
    Input fields seem to have a minimum height now when driven by a layout group?

    With TMP 1.4.1 we can't make input fields inside a layout group less tall than seen on the right anymore, which is unfortunately quite a bit taller than we'd like them to be.
    Seems like a problem with the preferred height calculation in TMP_Text?
     
  30. Fesener

    Fesener

    Joined:
    May 3, 2018
    Posts:
    33
    Is there any way to automate this process? I'm working on fairly large project and it would be really painful to revisit each prefab and scene objects to fix this :(
     
  31. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll take a look to see what I can do but that will require a new release.
     
  32. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I did make some changes related to this that will be in the next release but I would like to take another look with your example if you can provide it to me.
     
  33. Sebioff

    Sebioff

    Joined:
    Dec 22, 2013
    Posts:
    218
    I have attached a reproduction project
     

    Attached Files:

    Stephan_B likes this.
  34. cmann

    cmann

    Joined:
    Aug 1, 2015
    Posts:
    31
    Would better underlines be possible?
    I was thinking there could be two extra options.
    1. Currently it just stretches the middle out like the underline in the picture below.
      An option to change tile it instead, eg. sprite tiling like the sprite in the bottom of the picture.
      It could just default to say 5% padding on either side, or provide options to change the padding.
    2. Maybe an option to use a specific character, aside from the underscore.
    upload_2019-7-6_13-37-47.png
     
  35. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I would like to improve the handling of Underline and Strikethrough at some point so this is a good suggestion.

    P.S. I would suggest re-posting this in the parent section of the forum since this is a feature request and would make it easier to find / track by other users who may be interested in this.
     
  36. bradbecker

    bradbecker

    Joined:
    Dec 26, 2014
    Posts:
    130
    Upgrading to 1.4.1 seems to have really changed the value of em's when used for vindent, cspace, etc. Is this a known issue?
     
  37. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The previous handling of em spacing / handling was wrong and was corrected. My apologies for the impact of the change.

    I made some additional minor tweaks in the incoming version 1.4.2 (should no longer affect these value as the additional change mostly relates to the inspector Character, Word, Line and Paragraph spacing where these are in 1/100 em values now.

    These changes will ensure these new values much more closely mirrors what you would get from external typesetting applications.
     
  38. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just letting you know that I am making changes to address the behavior you have reported where I want to padding values defined in the Text Area to also be considered but for the time being, you can make the changes described below to get back to the previous behavior.

    This is simply due to the extra padding (value of 20) being added to the preferred height in the TMP_InputField.cs.

    This extra padding is being added in the "public virtual float preferredHeight" function where it adds an extra 20. Changing this value to zero will get you the old behavior.
     
  39. insanefeng

    insanefeng

    Joined:
    May 24, 2014
    Posts:
    4
    Hello

    I switched to Unity 2018.4.5 and get the newest TextMeshPro (1.4.1). When I use "Sprite Importer" to Create&Save Sprite Asset, the "Sprite Character Table" and "Sprite Glyph Table" is nothing but it work fine on 1.3.0(the data source(json arry(Texture Packer) format) and texture atlas are the same),Is it what I missed?

    Best Regards.
     
  40. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll take a look and provide feedback once I have more information.
     
    insanefeng likes this.
  41. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
  42. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Please post the above as a separate topic in the main section of the forum. This way it will be easier for other users to find when searching.

    I'll provide more details in my reply to that post but you should be able to use the newer API to add the necessary glyphs to the font asset.
     
  43. Finelay

    Finelay

    Joined:
    Sep 23, 2018
    Posts:
    2
    Hello there,
    so I'm trying to upgrade two apps I made a while ago, because Google has some new requirements concerning the target platform (Android) and I needed to implement a link to a privacy policy. Therefore I need to create the apk file in a different unity version (At least 2017.4, to support the 64-bit architecture). Then I ran into problems with TMP, because I used it for both of my apps. I followed the steps above but still have errors in my console. Maybe someone can help me, that would be so great!^

    Here are some quotes of the log file:

    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6398)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6400,73): error CS1061: 'FaceInfo' does not contain a definition for 'subscriptOffset' and no accessible extension method 'subscriptOffset' accepting a first argument of type 'FaceInfo' could be found (are you missing a using directive or an assembly reference?)
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6400)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6402,46): warning CS0436: The type 'FontStyles' in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs' conflicts with the imported type 'FontStyles' in 'TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs'.
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6402)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6403,48): warning CS0436: The type 'FontStyles' in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs' conflicts with the imported type 'FontStyles' in 'TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs'.
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6403)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6407,52): warning CS0436: The type 'FontStyles' in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs' conflicts with the imported type 'FontStyles' in 'TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs'.
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6407)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6407,77): warning CS0436: The type 'FontStyles' in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs' conflicts with the imported type 'FontStyles' in 'TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs'.
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6407)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6413,86): error CS1061: 'FaceInfo' does not contain a definition for 'subscriptSize' and no accessible extension method 'subscriptSize' accepting a first argument of type 'FaceInfo' could be found (are you missing a using directive or an assembly reference?)
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6413)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6413,134): error CS1061: 'FaceInfo' does not contain a definition for 'subscriptSize' and no accessible extension method 'subscriptSize' accepting a first argument of type 'FaceInfo' could be found (are you missing a using directive or an assembly reference?)
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6413)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6416,57): warning CS0436: The type 'FontStyles' in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs' conflicts with the imported type 'FontStyles' in 'TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs'.
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6416)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6417,57): warning CS0436: The type 'FontStyles' in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs' conflicts with the imported type 'FontStyles' in 'TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs'.
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6417)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6422,78): error CS1061: 'FaceInfo' does not contain a definition for 'superscriptSize' and no accessible extension method 'superscriptSize' accepting a first argument of type 'FaceInfo' could be found (are you missing a using directive or an assembly reference?)
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6422)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6422,128): error CS1061: 'FaceInfo' does not contain a definition for 'superscriptSize' and no accessible extension method 'superscriptSize' accepting a first argument of type 'FaceInfo' could be found (are you missing a using directive or an assembly reference?)
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6422)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6424,73): error CS1061: 'FaceInfo' does not contain a definition for 'superscriptOffset' and no accessible extension method 'superscriptOffset' accepting a first argument of type 'FaceInfo' could be found (are you missing a using directive or an assembly reference?)
    (Filename: Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs Line: 6424)

    Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs(6426,46): warning CS0436: The type 'FontStyles' in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs' conflicts with the imported type 'FontStyles' in 'TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\Finn Borchers\Documents\Unity Projekte\Pentagon\Library\PackageCache\com.unity.textmeshpro@1.4.1-preview.1\Scripts\Runtime\TMP_Text.cs'.
     
  44. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Looks like you have (2) two versions of TextMesh Pro in your project. Starting with Unity 2018.3, TextMesh Pro is included by default. It is included / delivered via the Package Manager.

    Since the legacy / Asset Store versions of TextMesh Pro use a different set of GUID and FileID, you will need to migrate to this newer version of TextMesh Pro. Please see the following thread and instructions on how to migrate to the newer release.

    Please be sure to go back to your backup of your project for Unity 2017.4 and follow the instructions in the thread I linked above. Make sure you switch Asset Serialization mode to Force Text in Unity 2017.4 to avoid issue with the conversion of Prefabs.
     
  45. Finelay

    Finelay

    Joined:
    Sep 23, 2018
    Posts:
    2
    Thank you so much! It worked. Now I can upgrade my apps :)
     
    Stephan_B likes this.
  46. xZanrok

    xZanrok

    Joined:
    Aug 8, 2019
    Posts:
    2
    Hello Stephan,

    I was wondering if you could add support to add multiple Outlines (strokes).. so we could create a text material with say 3 Strokes. A lot of our artists like to use photoshop to create their fonts and photoshop has the ability to hit (+) to add multiple strokes to a font. Ideally, it could be a matter of modifying the original shader to support additional outlines and then when activated they would be used, otherwise it would only use 1 outline.

    Thanks in advance!
     
  47. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This has been requested previously and functionality that certainly makes sense in addition to being cool :)

    I have run into a few user project where users modified the TMP Shaders to add this type of functionality so if you have done some shader work in the past, that is certainly an option to consider.

    I think the best longer term plan / option would be to add support for SDF Nodes in Shader graph to allow users to modify / create custom shaders that would provide these types of functionality.

    I'll reach out to the Shader Graph team to further explore this.

    P.S. Since this type of request is likely to interest other TMP users as well, I would recommend posting this in the main thread / channel so other can see / find it more easily.
     
  48. wuhuan

    wuhuan

    Joined:
    Mar 12, 2014
    Posts:
    9
    It can't work. Unity 2018.4.6,TMP 1.4.1
    upload_2019-8-18_16-24-51.png upload_2019-8-18_16-25-3.png

    Can I just use scale X to 0 for hide text?
     
  49. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Scale X & Y are related to SDF Scale and not related to the scale of the text.

    An SDF Scale of Zero will result in white squares. An SDF square that is too small will produce text that appears too soft whereas an SDF scale that is too large will make the text overly sharp.

    Scaling of the text object should work (via the RectTransform) provided you use uniform scale.
     
  50. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    470
    HI!
    I'm a happy user of TMP and it was very fine in 2017.
    I moved to 2019 recently and I had to destroy several assets that were throwing errors, even if they were fairly recent. Painful and annoying, this move to 2019.
    By sheer curiosity, I reinstalled those assets, errors were solved for the most part. I'm not sure why Unity couldn't update those assets and wanted me to destroy them first. Maybe something weird with the meta files?

    Anyway, that's for the context.
    With TMP, the same happened, I had 140+ errors.

    1. I deleted the TMP folder in Assets.
    2. Errors went away. Scripts too.
    3. Thus all my texts couldn't be displayed. All TMP text elements are looking for a script they can't find. "The associated script cannot be loaded."
    4. Same with the fonts I had created, all stored in a Fonts folder under Assets. They're all looking for a script too.
    5. In TMP, there's an "essential resources" package. I double clicked it, to see what would happen. It installed a TMP folder in Assets; some resources I was used to see but nothing useful to me.
    6. Nevertheless the references to the TMP script are still empty.

    Not sure what to do from there. Should I reinstall TMP in Assets, then run some kind of tool or metascript that would parse and update all references to the proper script(s) (located in Packages / TMP)?