Search Unity

TextMesh Pro Creating, or altering, TMP Font Assets at runtime possible? (to adjust sampling point size)

Discussion in 'UGUI & TextMesh Pro' started by Multiplayer, Feb 5, 2020.

  1. Multiplayer

    Multiplayer

    Joined:
    Dec 29, 2012
    Posts:
    15
    Hi,

    SDF font rendering is nice. But if text is only displayed in 2D, and I know the exact pixel size, it seems that bitmap fonts are still the sharpest option. However, that is only true as long as the TMP font asset is created with the exact same sampling point size.

    If the pixel size can change, that probably means I should adjust the sampling point size of the TMP font asset accordingly.

    Creating the bitmap font atlas seems to be fast enough for what I need. And in the Unity editor, the atlas for the TMP font assets can even be created dynamically.

    However, I have failed to find any way to change the sampling point size at runtime. I can neither create font assets from scratch, nor change the sampling point size on an existing font asset (and force it to recreate the atlas).

    Is there any way to do this?