Search Unity

TextMesh Pro [SOLVED] Can i remove default LiberationSans SDF font use my font?

Discussion in 'UGUI & TextMesh Pro' started by dohaiha930, Mar 27, 2018.

  1. dohaiha930

    dohaiha930

    Joined:
    Mar 27, 2018
    Posts:
    55
    Hi everyone, i used TextMeshPro for my text ingame, it's very great.
    When i build my game, it' include default font LiberationSans SDF over 1mb in my mobile game size. I try to delete that, it's still working, but when i try to create new text, it will create with default font LiberationSans SDF, but i deleted it before so it fire an error "LiberationSans SDF missing", i must change new font on inspector then reload scene for working with new font.

    So my question is Can i change default font use my font without LiberationSans SDF ?

    Thanks!
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    When a new text object is created, TextMesh Pro will assign the font asset Default Font Asset assigned in the TMP Settings file as seen below.

    upload_2018-3-26_20-31-28.png

    Since you deleted the LiberationSans SDF font asset and most likely didn't assign a replacement, then TMP (out of desperation since it can't find anything to assign) try to find this LiberationSans SDF which is hard coded.

    So to use your own font asset, simple assign your font asset as the Default Font Asset in the TMP Settings file.

    P.S. You don't need to delete the LiberationSans SDF, you just need to move it out of the Resources folder since anything included in a Resources folder get included in a build by default.
     
  3. dohaiha930

    dohaiha930

    Joined:
    Mar 27, 2018
    Posts:
    55
    Stephan_B likes this.
  4. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    @Stephan_B I exchanged LiberationSans with my own font in Settings, as you described above. I moved all Liberation font resources to an "Unused" folder next to "Resources". The Liberation font still made it into the build, until I finally deleted them. Some internal usage was obviously somehow retained (though there were no complaints after deleting them).