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 Version 1.5.1, 2.1.1 & 3.0.1 - Now Available! for Testing!

Discussion in 'UGUI & TextMesh Pro' started by Stephan_B, Oct 1, 2019.

  1. Driven

    Driven

    Joined:
    May 31, 2013
    Posts:
    77
    @Stephan_B thanks for fix, it worked! i just read you wrote something about a bug connected with canvas disabled but i'm not sure if this is related to another bug report i just made for you. maybe you can have a look, the bug is that the submeshUI is blocking raycasts for no reason, the case number is 1240784.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Was this behavior present in previous releases?

    I'll take a look tomorrow morning and following as soon as I have more information.
     
  3. Driven

    Driven

    Joined:
    May 31, 2013
    Posts:
    77
    Yes it was present previously as well but I'm not sure in which version it was introduced, maybe it was there all the time but i couldn't reproduce it until now by trying out the canvas thing.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just found another post on this topic which I apparently missed. I am pretty sure I'll have a code change solution for this tomorrow which will then get included in a subsequent release of the package.

    Here is that thread which does include potential short term solution.
     
  5. Driven

    Driven

    Joined:
    May 31, 2013
    Posts:
    77
    Sounds kind of like the same issues yes. By the way ignore my comment in the case regarding scale,i was just confused but the object itself was scaled.
     
  6. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    Thanks @Stephan_B, the FontEngine changes sound particularly awesome. One thing that worries me about this is that you said these improvements would require a new version of Unity. Does this mean we'd need to be using the 2020 tech releases or will these Font Engine upgrades be available for LTS branches as well? We're using 2018.3.20f1 currently.
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I am planning on having those changes to the FontEngine available in Unity 2018.4 or newer.
     
  8. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    OK, good, thanks. Yes, sorry, I meant 2018.4.20f1, not 2018.3
     
  9. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi @Stephan_B Have a strange problem when updating TextMeshUGUI text. Text is not rendering in some circumstances. This is an existing project that was working fine with beta 8, but the problem is there in beta 11. I rolled back to beta 8 and everything renders correctly again.
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you submit a bug report with the project and steps to reproduce as this issue should have been resolved in Preview 11?
     
  11. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi @Stephan_B

    All submitted in an example project where it happens all the time. Case 1245445

    Justin
     
    Stephan_B likes this.
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for submitting the bug report along with the project.

    I had a chance to look at this earlier today and have resolved this issue which was the result of the RectMask2D calling Cull() on the text object before it being rendered.

    This will be fixed in Preview 12 of the TMP package which should be available tomorrow via the Package Manager.
     
    SketchWork likes this.
  13. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Preview 12 of the TMP package is now available via the Package Manager.

    The ChangeLog for this release is below and will be available within the next 24 hours online.

    ### Changes
    • Added synchronization of the RaycastTarget property of the parent <TextMeshProUGUI> with potential child sub text objects. Case #1240784
    • Fixed Font Asset Bold Spacing adjustment scaling based on the text object point size instead of current point size. Case #1241132
    • Improved text alignment when using RTL in conjunction with character, word and other spacing adjustments.
    • Fixed TMP Input Field caret potentially not being visible when reaching the right side of the viewport. See [forum post](https://forum.unity.com/threads/inputfield-bug-2.879244/) for more details.
    • Fixed TMP Input Field incorrect text RectTransform horizontal adjustment when using the Backspace key. See [forum post](https://forum.unity.com/threads/inputfield-bug4-delete-and-backspace-bug.879283/) for more details.
    • Fixed potential null reference in the TextMeshProUGUI.Cull function when using a workflow that involves enabling / disabling Canvases in the scene.
    • Fixed ArgumentOutOfRangeException when using the "Update Sprite Asset" inspector option on a sprite asset that does not contain any sprites. Case #1242936
    • Fixed incorrect culling of the text geometry by the RectMask2D component on newly created text objects. Case #1245445
    • It is now possible to use the Material Context Menu options to Copy / Paste Material Properties or Atlas Texture originally created for TMP with all other non TMP specific materials. Case #1242671
    • Fixed NullReferenceException when setting the Atlas Texture to None in the Debug Settings of the Material Inspector of a text object. Case #1245104
    Please report any potential issues with this release.
     
    SketchWork likes this.
  14. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    704
    Hi Stephan, just wondering if you feel like the preview is nearing an end now?
     
  15. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Yes.

    I have 3 minor items that will be addressing in Preview 13 which are:
    Plus a culling issue where the bounds of the text geometry are incorrectly calculated due to lossyScale not being accounted for when using a RectMask2D.

    Those are the only items so far for Preview 13 which I will try to release Friday or over the weekend.
     
    PeachyPixels likes this.
  16. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    704
    That's great news, many thanks Stephan.
     
  17. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Hi @Stephan_B.

    Preview 12 fixed that issue thanks, but I'm still getting non-rendered text in other places too. So the culling is still happening in some instances in a scroll rect component.

    I'll try to replicate it in another example project for you and submit it.

    Justin
     
  18. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Can't seem to replicate it in an example project, although it happens every time in my actual product :( but has something to do with the size of the detail text mesh pro ugui on a scroll rect and rect mask 2d. As soon as you move the scroll everything appears again. Also, if you disable the rect mask 2d and reenable it everything reappears again too. Must be something more to do with the culling code you were tinkering with.

    Reverting back to preview 8 and everything works perfectly again.

    Sorry mate.

    Justin
     
  19. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I did get a report of another issue related to Culling which is related to scaling of objects in the Hierarchy. I do have a fix coming in Preview 13 to handle scaling related culling issues.

    The reason these new issue are occurring is because culling of the text is now based on the geometry as opposed to the RectTransform of the text where in different use case the text can overflow the bound of the RectTransform and get cull incorrectly.
     
    SketchWork likes this.
  20. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Ahh ok. I'll give it another test when Preview 13 is out.

    Cheers buddy, Justin
     
  21. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    I am also having intermittent problems with TMP UGUI text not rendering in some intermittent cases and I'm having problems tracking it down. It seems to only affect prefabbed text. I'm feeling that this isn't exactly what you're describing due to the text not having any scaling or a mask. I might need to revert back to an earlier preview since I have a deliverable soon, but if preview-13 is coming soon I can wait to try it.
     
  22. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I will be releasing Preview 13 today which I believe should resolve that issue.
     
    Ferazel and SketchWork like this.
  23. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,091
    Affected Version: 2.1.0-preview.12 & tried preview 13 as well.
    Cannot reproduce this with 2.1.0-preview.8 in our large project.

    Problem:
    I seem to get a null reference exception after instantiating one of my prefabs.
    Funny thing is, I cannot reproduce it in a small repro project. Not sure what the conditions are of the OnCanvasGroupChanged event.

    I have a very complex UI setup where I set the canvasgroup interactable false just before I instantiate the prefab containing a TMP_InputField somewhere as child deeply nested.
    As soon as I remove the interactable = false line, it no longer triggers the event.
    But when I do this in a reproduction project... it doesn't even seem to affect it at all for some reason. it's just not easily reproducable.

    But it seems that the
    m_textInfo
    has not yet been initialized when this happens.
    But as I discovered a lot of times TMP requires 1 frame to be fully initialized else it contains quite some bugs.
    In this case I cannot wait 1 frame due to the fact this event is called somehow.

    StackTrace:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.TextMeshProUGUI.InternalCrossFadeColor (UnityEngine.Color targetColor, System.Single duration, System.Boolean ignoreTimeScale, System.Boolean useAlpha) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TextMeshProUGUI.cs:478)
    3. TMPro.TMP_Text.CrossFadeColor (UnityEngine.Color targetColor, System.Single duration, System.Boolean ignoreTimeScale, System.Boolean useAlpha) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TMP_Text.cs:1841)
    4. UnityEngine.UI.Selectable.StartColorTween (UnityEngine.Color targetColor, System.Boolean instant) (at C:/Unity/2019.3.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:1013)
    5. UnityEngine.UI.Selectable.DoStateTransition (UnityEngine.UI.Selectable+SelectionState state, System.Boolean instant) (at C:/Unity/2019.3.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:659)
    6. TMPro.TMP_InputField.DoStateTransition (UnityEngine.UI.Selectable+SelectionState state, System.Boolean instant) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TMP_InputField.cs:4247)
    7. UnityEngine.UI.Selectable.OnSetProperty () (at C:/Unity/2019.3.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:514)
    8. UnityEngine.UI.Selectable.OnCanvasGroupChanged () (at C:/Unity/2019.3.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:443)
    9. UnityEngine.Object:Instantiate(GameObject, Transform, Boolean)
     
    Last edited: May 19, 2020
  24. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I have seen this before but have never been able to reproduce it.

    The textInfo is populated when the text object is processed which happens just before the frame is rendered. There is no frame delay but since the text object is rendered late, it might make it seem like it happens on the next frame.

    Does the issue happen reliably in your main project? If so, can you submit a bug report with that project?

    P.S. In the short term, you could add a null check on the textInfo and simply return if null. There are few other ways this could be handled as well but I would like to be able to reproduce this to figure out exactly why / when it occurs to be sure the solution is correct.
     
    Last edited: May 19, 2020
  25. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    Unfortunately, preview 13 did not fix my issue. I don't have time to determine the underlying problem. Hopefully, someone else can find the issue and submit. I think it might be due to a vertical layout group on the parent of the text? That's just a guess though.
     
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    That would affect layout but not the rendering itself.

    For quick testing, in the TMPro_UGUI_Private.cs around line 1522, in "protected override void OnRectTransformDimensionsChange()", comment out this section completely.

    Code (csharp):
    1.  
    2. // Comment this section below
    3.  
    4. // Ignore changes to RectTransform SizeDelta that are very small and typically the result of rounding errors when using RectTransform in Anchor Stretch mode.
    5. /*
    6. if (rectTransform != null &&
    7.     Mathf.Abs(m_rectTransform.rect.width - m_PreviousRectTransformSize.x) < 0.0001f && Mathf.Abs(m_rectTransform.rect.height - m_PreviousRectTransformSize.y) < 0.0001f &&
    8.     Mathf.Abs(m_rectTransform.pivot.x - m_PreviousPivotPosition.x) < 0.0001f && Mathf.Abs(m_rectTransform.pivot.y - m_PreviousPivotPosition.y) < 0.0001f)
    9. {
    10.     return;
    11. }
    12. */
    13.  
    and let me know if the text shows up.

    Does your scene hierarchy include a RectMask2D somewhere in there?
     
  27. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,091
    Good thing, I have been able to reproduce it into a smaller project!
    I did bring the whole prefab to it and it'll complain a lot about missing behaviours as there are many but it shows the error on play.
    The case number: 1248935
     
    Stephan_B likes this.
  28. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for taking the time to submit the bug report. I'll take a look tomorrow and provide feedback as soon as I have more information.
     
  29. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    I apologize, but this is such an intermittent problem. I removed the TMP package and copied the code into the project and made the change you requested to OnRectTransformDimensionsChange() and there are still situations where there is text is not rendering (blank). There are no RectMask2Ds in the hierarchy all. This is a screenspace overlay canvas. The functionality is still there but the text looks like it is getting culled. I'm having a difficult time trying to repro the issue consistently on my computer, but I do see it in builds and other team members are having this problem too. I may need to jump back to 2.0.1 at this point, but there is definitely still a bug in the code.

    I'm on Unity2019.3.12 and 2.1.0-Preview13.

    A co-worker was able to reproduce this bug in the editor, but we're all working remotely so I couldn't connect my debugger.

    I disabled and re-enabled the TMP component - Did not re-render
    I disabled and re-enabled the GameObject - Did not re-render
    I disabled and re-endabled the canvas - Did not re-render correctly
    I disabled and re-enabled the canvas GameObject - Did not re-render correctly.
    I resized the game view - Text updated and was rendered correctly.
    I changed the material to another material preset - Text updated and was correct.
    I changed other TMP labels to the material that the missing buttons where using - Text became invisible.
    I tried to use multiple fonts for each of the labels - All of the fonts that were used their materials become invalid when this issue occurs. I can not assign labels these fonts or they will not render.

    What seems to be weird is that only the "default" (subasset) font materials seem to be getting corrupted. If I create another font material and assign it to the labels the labels will stay visible. This is the workaround I'm going to use for now.

    I'm thinking that there might be a material property that is getting bad data? I looked at the material in debug mode and I didn't see anything wrong compared to a font that works though.
     
    Last edited: May 21, 2020
  30. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The only changes that should have had any affect on the text visibility is the OnRectTransformDimensionsChange() and the Culling changes on TextMeshProUGUI.cs Cull method.

    How complex is your scene hierarchy? Are you using nested Canvases with a bunch of Canvas Groups? Can you PM me an image of this?

    I would hate to you have go back to 2.0.1 as there are lots of improvement in these newer releases. Obviously, I understand that if the text is not rendering, you have little choice but also feel that if I could reproduce this it would likely be a simple fix.

    Did you update the TMP Essential Resources which include new shaders at some point since 2.0.1?

    P.S. If you do manage to reproduce the issue or run into it easily, just submit a bug report with the full project and steps to reproduce (if you can).
     
    Ferazel likes this.
  31. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Aww, preview 13 still doesn't fix my text disappearing problem. Reverted back to Preview 8 and everything works again.

    My problem is on a nested canvas with 2D Masks and Scrollers. It is a section screen and some things I select the text renders correctly and others always fail to render until I move the scroller then they reappear.
     
    Last edited: May 21, 2020
  32. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    You may have been right, I must have forgot to update the essential resources. Which might have been causing problems on materials without a _CullMode property. I updated the shaders and my variants of them. I'll try to get time after this milestone to get a bug submitted if I see it again. Thanks for your help.
     
  33. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide me with some repro scene / project for this or just submit a bug report with the project so I can reproduce the issue? Whatever is easier for you to help me reproduce this so I can fix it.
     
  34. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    I have the same problem with m_textInfo in versions 1.5.0 - preview 10, 11, 12 and 13. There is no problem with version 1.5.0 - preview 8.

    It's when I instantiate prefab with TextMeshPro components and then change it's parent immediately.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.TextMeshProUGUI.InternalCrossFadeColor (UnityEngine.Color targetColor, System.Single duration, System.Boolean ignoreTimeScale, System.Boolean useAlpha) (at Library/PackageCache/com.unity.textmeshpro@1.5.0-preview.12/Scripts/Runtime/TextMeshProUGUI.cs:478)
    3. TMPro.TMP_Text.CrossFadeColor (UnityEngine.Color targetColor, System.Single duration, System.Boolean ignoreTimeScale, System.Boolean useAlpha) (at Library/PackageCache/com.unity.textmeshpro@1.5.0-preview.12/Scripts/Runtime/TMP_Text.cs:1841)
    4. UnityEngine.UI.EnchancedButton+AnimationGraphic.StartColorTween (UnityEngine.UI.EnchancedButton+AnimationGraphic+SelectionState state, System.Boolean instant) (at Assets/Scripts/Interface/Hud/UiObjects/MassButton/EnchancedButton.cs:87)
    5. UnityEngine.UI.EnchancedButton.DoStateTransition (UnityEngine.UI.Selectable+SelectionState state, System.Boolean instant) (at Assets/Scripts/Interface/Hud/UiObjects/MassButton/EnchancedButton_Interfaces.cs:61)
    6. UnityEngine.UI.Selectable.InternalEvaluateAndTransitionToSelectionState (System.Boolean instant) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Selectable.cs:1043)
    7. UnityEngine.UI.Selectable.OnSetProperty () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Selectable.cs:446)
    8. UnityEngine.UI.Selectable.OnCanvasGroupChanged () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Selectable.cs:374)
    9. UnityEngine.UI.Selectable.OnTransformParentChanged () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Selectable.cs:436)
    10. UnityEngine.Transform:SetParent(Transform, Boolean)
    I think it's because m_textInfo is no longer serialized, but older prefabs still have it serialized in file and nested prefabs too have references to changes in this field.

    When I uncomment SerializeField again in file TMP_Text.cs there is no longer problem with it. Or for added components in current preview version (13):
    Code (CSharp):
    1. //[SerializeField]
    2. protected TMP_TextInfo m_textInfo;
     
  35. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    349
    Strange behaviour of centered texts now, I think it came with preview .13. It doesn't happen in all situations.

     
  36. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Interesting ... let me see if I can reproduce the issue.

    I guess I need some setup / prefab structure where the CrossFadeColor is called on Instantiation.

    Edit: I still can't reproduce the behavior on my end.

    Instantiating a prefab calls Awake where an instance of textInfo is created. So for this issue to occur, CrossFadeColor has to be called before Awake on the text object which should not happen.

    What is UI.EnchancedButton?

    Are you calling some function that would cause CrossFadeColor to be called on your end prior to the text object being Awakened / Enabled in the scene?
     
    Last edited: May 23, 2020
  37. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Is this something I can reproduce in the project you provided me?

    What are the steps to reproduce?
     
  38. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    Yes. It was problem with CrossFadeColor. It was called on init and sometimes it was called on objects which were disabled on init immediately (or disabled on init). So checking if object is enabled fixed problem.

    But still it shouldn't crash scripts just because it was called on disabled object or in wrong time. I see that only some methods are checking if m_textInfo; is null, but not all.

     
  39. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I will be adding the null check but before making any changes, I like to first understand the cause of those issues. As adding just a null check could hide some other issue somewhere.
     
    dwit_mass_creation likes this.
  40. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just wanted to provide a quick update on this current release series of the TMP package.

    Other than the disappearing text issue which I still can't reproduce all other reported issues have been addressed.

    If you are aware of any other outstanding issues in the current release series or have issues that you have not yet had the time to report please do so as I would like to move towards getting this release series verified :)
     
  41. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    My disappearing text issue always happens and is totally dependant on the size of the text in the TMProUGI component, but I can't replicate it in a small demo project which is really frustrating.
     
  42. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Make sure that you did update the TMP Essential Resources as new shaders were included in these since Preview 7.

    Next... What do you mean by size? Are you scaling the text object? Make sure the scale never hit 0. So something like 0.0001f is fine.
     
  43. SketchWork

    SketchWork

    Joined:
    Jul 6, 2012
    Posts:
    254
    Have definitely installed the new resources and by size, I mean the size of the text object. I don't scale the actual transform it is literally the amount of text in the object with overflow. The case scenario is this:
    I have a selection window with different records on the left and the fields for each record on the right. You click a record on the left and the fields are populated on the right. Some records you click are fine and some don't render till you move the scrollrect. There is nothing different between the records other than the text getting displayed. Everything works perfectly in preview 8.
     
  44. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide me with some repro project or submit a bug report with the project for me to look at?
     
  45. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    322
    I'm using Preview13.
    Do you have any hint of why TextMeshPro is creating 1.6kb of GC Alloc each frame?

    upload_2020-6-2_12-26-46.png

    Am I doing something wrong? What makes it calls Rebuild each frame?
     
  46. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I will need more details to provide any insight.

    Are you changing the text each frame?

    Are you using SetText or the .text property?

    If using SetText, it does result in allocation in the Editor to keep the Inspector in sync with the text but this does not happen in the Player / Runtime.
     
  47. michaeleconomy

    michaeleconomy

    Joined:
    Aug 28, 2018
    Posts:
    58
    Hey, I'm trying out the new release and i got this error:

    Material doesn't have a float or range property '_CullMode'
    UnityEngine.Material:GetFloat(String)
    TMPro.TMP_SubMeshUI:UpdateMaterial() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TMP_SubMeshUI.cs:717)
    TMPro.TMP_SubMeshUI:SetMaterialDirty() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TMP_SubMeshUI.cs:615)
    TMPro.TMP_SubMeshUI:RecalculateMasking() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TMP_SubMeshUI.cs:751)
    TMPro.TMP_SubMeshUI:ON_MATERIAL_PROPERTY_CHANGED(Boolean, Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TMP_SubMeshUI.cs:418)
    TMPro.FastAction`2:Call(Boolean, Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/FastAction.cs:109)
    TMPro.TMPro_EventManager:ON_MATERIAL_PROPERTY_CHANGED(Boolean, Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Runtime/TMPro_EventManager.cs:57)
    TMPro.EditorUtilities.TMP_BaseShaderGUI:prepareGUI() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Editor/TMP_BaseShaderGUI.cs:144)
    TMPro.EditorUtilities.TMP_BaseShaderGUI:OnGUI(MaterialEditor, MaterialProperty[]) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.13/Scripts/Editor/TMP_BaseShaderGUI.cs:158)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    unitiy version 2019.3.14f1
    osx latest

    I;m also getting an issue where the text thinks it wrapping but is not? (screenshot attached)
    Screen Shot 2020-06-02 at 12.40.21 PM.png


    the top row is correct, but the second row is double height, (like it must think it's wrapping, but isn't?)

    (these are inside a vertical layout)


    I just moved over from using the Text class, so there could be something dumb i'm doing here.

    I upgraded to the preview of TMP becasue my text in an TMP_InputField was just strangely disappearing. The new version seems to have fixed that.


    Thanks,
    -Michael
     
  48. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The "_CullMode" error will be resolved by updating the TMP Essential Resources as new functionality was added to the shaders to make it easier to control cull mode via the option in the debug section of the material inspector.

    In terms of the text layout, do you have layout components involved in this?
     
  49. michaeleconomy

    michaeleconomy

    Joined:
    Aug 28, 2018
    Posts:
    58
    Thanks for the quick response!

    There's no layout elements on the TMP_Text directly, it's genereating two children that have layout elements with the ignore flag set to true. They are wrapped in a series of vertical layout groups, content size fitter, scroll view, etc. It's behaving as if the text had wrapped, but it hasn't yet wrapped. so if i add a few words it looks correct, and if i remove a word, it looks correct also. Maybe something about the way i've done the font?

    The only thing custom here is that i linked in the bold/itatlics fonts (this is googles cormorant font). Screen Shot 2020-06-02 at 3.24.56 PM.png
     
  50. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The reason I was asking if Layout Components were used in the scene hierarchy / parent of the text object is because the Layout System doesn't correctly handle text which unlike other UI components like images is more complex due to word wrapping.

    For instance, when the layout system queries an image for its preferred width and height, the image component returns a value. Then the layout system looks at other objects and eventually figures out how much it will allocate to this image component. With an image where it scale linearly regardless of the size of the RectTransform, the layout system changing its mind is fine.

    In the case of text, the layout system queries the text object for its preferred values where the text says given whatever width and height you are giving me and considering auto-size / word wrapping here is what my preferred values would be where the text ends up on two lines. However, after the text has provided these preferred values, the layout system changes the size of the RectTransform where using auto-size with these new (smaller) dimensions the largest possible point size only requires a single line of text. This is why we end up with extra space above and below the text

    This behavior is usually the result of having expand child enabled on those layout components.

    Basically, we need the layout system to either stick to whatever dimensions it told the text system is had available or in the event it ends up where it has to change these initial dimensions, query the text system again for updated preferred values based on these modified dimensions.

    P.S. You might be able to get around this by changing the layout component settings like removing the force child expand.