Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

TextMesh Pro <material> tag not working

Discussion in 'UGUI & TextMesh Pro' started by ookk47oo, Feb 8, 2022.

  1. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    I want to switch different fonts and material presets at runtime and I followed the documentation to set it up.
    GA[C(85)31R@AN{W{[T1B_B.png

    It is ok when there is only <font> tag.
    P5L`H@@L$D}~V)U23(__N6P.png
    But when I added the <material> tag, the rich text was broken.
    0]YWE3}RY8G0FG7$~HSBVZR.png

    The Tmpsetting path is also right. Is there anything I got wrong?
    3(ZGIZ49(CMR1~6PW]Q5%`X.png
     
  2. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    Never mind. I missed a slash symbol '/' at the end of path.o_O
    7B}L45ZPX(D8)2PPCW}NP56.png
     
  3. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    Well, things above are worked for Resource.Load. Howerver, if I use assetbundle, the material cannot be loaded.So I modified the TMP_Text.cs and add an event called OnMaterialAssetRequest , which is similar to OnSpriteAssetRequest.
    8YO267_62MWNM7P@H}GKNBQ.png


    Invoke this event before Resource.Load<Material>.
    C%[[$D})BV21(0SCI(%JBQ6.png

    Register the event And then load the material from assetbundle.

    . )U1MY91]%9P]6L4L$B7(LNO.png