Search Unity

TMP HDRP works in Editor not in Build

Discussion in 'UGUI & TextMesh Pro' started by azcoffeehabit, May 11, 2022.

  1. azcoffeehabit

    azcoffeehabit

    Joined:
    Jun 14, 2015
    Posts:
    13
    Hello,

    I could use some help with importing ttf fonts in TMP + HDRP.

    Unity 2021.2.f16 / TMP 3.0.6 / TMP 3.2.0.pre-3

    I can import the fonts and creating the texture atlas works with good result in the Wizard.
    https://www.dafont.com/smalltypewriting-medium.font?text=earth

    upload_2022-5-10_18-54-29.png

    I have installed the SRP shaders from the forum post on HDRP + TMP
    https://forum.unity.com/threads/plans-for-hdrp-compatibility-for-tmp.660598/page-2

    When I assign the TMP_SDF-HDRP UNLIT Shader to the Material I get a Console Error. (Editing the shadergraph and adding the missing _ScaleResultA (float) clears the error but for this test i am running with the error)
    Material 'SmallTypeWritingMedium SDF Material' with Shader 'TextMeshPro/SRP/TMP_SDF-HDRP UNLIT' doesn't have a float or range property '_ScaleRatioA'
    UnityEngine.Material:GetFloat (int)
    TMPro.TextMeshProUGUI:GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMPro_UGUI_Private.cs:2209)
    TMPro.TextMeshProUGUI:OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMPro_UGUI_Private.cs:1670)
    TMPro.TextMeshProUGUI:Rebuild (UnityEngine.UI.CanvasUpdate) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TextMeshProUGUI.cs:216)
    UnityEngine.Canvas:SendWillRenderCanvases ()


    And I get below in the editor which is what I expect/want
    upload_2022-5-10_18-39-48.png


    But when I run the scene the Fonts are in the scene but a very odd blue color but the font is correct
    upload_2022-5-10_18-40-23.png

    But, when I create a build and run I get no fonts displaying at all

    upload_2022-5-10_18-44-30.png

    I could use some help trying to figure out what is going on here?

    Thank you for checking this out!
     
    Last edited: May 11, 2022
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Make sure that you are using version 3.2.0-pre.3 with Unity 2020.3 or newer.

    Since TMP Essential Resources have been updated in this new release which includes new shaders for both URP and HDRP, you will need to re-import the TMP Essential Resources by using the "Window - TextMeshPro - Import TMP Essential Resources" menu option.

    Note: Before importing the updated TMP Essential Resources, be sure to remove the older shaders that you downloaded from the forum. These would be located in the "TextMeshPro/Shaders" folder. If this is a new project, you can actually delete the whole "TextMesh Pro" folder and then re-import the TMP Essential Resources.
     
  3. azcoffeehabit

    azcoffeehabit

    Joined:
    Jun 14, 2015
    Posts:
    13
    Thanks for getting back to me

    I still get the same behavior after creating a new project and perform the steps to upgrade to TMP 3.2.0-pre.3

    upload_2022-5-11_7-40-33.png

    I noticed that the error "Material 'SmallTypeWritingMedium SDF Material' with Shader 'TextMeshPro/SRP/TMP_SDF-HDRP UNLIT' doesn't have a float or range property '_ScaleRatioA' UnityEngine.Material:GetFloat (int)" is no longer showing in the console.

    Thank you for your time
     
  4. dragoNogarb

    dragoNogarb

    Joined:
    Nov 19, 2012
    Posts:
    6
    I got the same problem about Material doesn't have a float or range property '_ScaleRatioA' can you tell me how to fix it

    FIXED: ok you can edit shader by shader graph and add float '_ScaleRatioA' then save asset Done
     
    Last edited: Jan 4, 2023
  5. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    530
    I have the same, shader from essentials definitely does not have that property in TMP Pro 3.2 pre4
     
  6. azcoffeehabit

    azcoffeehabit

    Joined:
    Jun 14, 2015
    Posts:
    13
    If I recall correctly I think that I deleted the existing TMP folders, re-imported TMP, then installed essentials and then reconverted the font file and I no longer had the error.

    It seemed like an issue with some older TMP files from an older version or something in my case.