Search Unity

TextMesh Pro Material exception on changing visibility

Discussion in 'UGUI & TextMesh Pro' started by SunSailor, Dec 4, 2019.

  1. SunSailor

    SunSailor

    Joined:
    Aug 22, 2012
    Posts:
    26
    I'm using Unity 2019.3.0f1 and TextMesh Pro Preview 2. I started to write a UI manager for my game, where panels are enabled and disabled to switch between them. When I toggle between active and inactive, either in code or even in the editor, I get tons of exceptions:

    Code (CSharp):
    1. Material doesn't have a float or range property '_CullMode'
    2. UnityEngine.Material:GetFloat(String)
    3. TMPro.TMP_SubMeshUI:UpdateMaterial() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_SubMeshUI.cs:691)
    4. TMPro.TMP_SubMeshUI:SetMaterialDirty() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_SubMeshUI.cs:601)
    5. TMPro.TMP_SubMeshUI:SetSharedMaterial(Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_SubMeshUI.cs:823)
    6. TMPro.TMP_SubMeshUI:set_fallbackMaterial(Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_SubMeshUI.cs:107)
    7. TMPro.TextMeshProUGUI:SetArraySizes(UnicodeChar[]) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMPro_UGUI_Private.cs:1430)
    8. TMPro.TMP_Text:ParseInputText() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_Text.cs:1858)
    9. TMPro.TextMeshProUGUI:OnPreRenderCanvas() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMPro_UGUI_Private.cs:1647)
    10. TMPro.TextMeshProUGUI:Rebuild(CanvasUpdate) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TextMeshProUGUI.cs:209)
    11. UnityEngine.Canvas:SendWillRenderCanvases()
    What is obvious visible in the inspector is, that on disabling the panel, all materials disappear from the TextMesh Pro objects, so this somehow makes sense not to be able to set culling... Any ideas, how to fix this or is this a TMPro bug in the end?

    Thanks in advance!
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    In Preview 2, the shaders were updated to include the new _CullMode property. However, these new shaders are contained in the updated TMP Essential Resources. As such these must be imported manually into the local project via the "Window - TextMeshPro - Import TMP Essential Resources". See the following post.

    Unless I run into some major issue, preview 3 will be available this week. It also includes some minor tweaks related to the addition of this _CullMode property.
     
    Goty-Metal and zuziv like this.
  3. SunSailor

    SunSailor

    Joined:
    Aug 22, 2012
    Posts:
    26
    Yeah, I know that and was pretty sure, I did this when upgrading. The issue came up recently during development, but re-importing fixed it indeed. Maybe something set back the imported files, need to check the source control for this, I think.