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:
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.2/Scripts/Runtime/TMP_SubMeshUI.cs:691)
TMPro.TMP_SubMeshUI:SetMaterialDirty() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_SubMeshUI.cs:601)
TMPro.TMP_SubMeshUI:SetSharedMaterial(Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_SubMeshUI.cs:823)
TMPro.TMP_SubMeshUI:set_fallbackMaterial(Material) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_SubMeshUI.cs:107)
TMPro.TextMeshProUGUI:SetArraySizes(UnicodeChar[]) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMPro_UGUI_Private.cs:1430)
TMPro.TMP_Text:ParseInputText() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMP_Text.cs:1858)
TMPro.TextMeshProUGUI:OnPreRenderCanvas() (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TMPro_UGUI_Private.cs:1647)
TMPro.TextMeshProUGUI:Rebuild(CanvasUpdate) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.2/Scripts/Runtime/TextMeshProUGUI.cs:209)
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?
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.
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.
I am necroposting here just in case someone can’t fix this problem with reimporting. This error happened to me because I had a package (Mobile Notifications) which had it’s own TextMeshPro package included with its own shaders (that didn’t have the ‘_CullMode’ property). I deleted the duplicate TextMeshPro package and it was solved.