Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

TextMesh Pro Need a way to change font for all instances of a Font Asset at runtime

Discussion in 'UGUI & TextMesh Pro' started by Splosions, May 8, 2024.

  1. Splosions

    Splosions

    Joined:
    Apr 29, 2017
    Posts:
    31
    I have been searching and testing for the past 6 hours and this is going to drive me up a wall.

    I am trying to allow a player to select what font they would like the game UI to be. Not everyone wants a pixel font in their UI.

    I was able to use the <font> tags in TMP in order to display a dropdown with a sample of every font available.
    But for the life of me I cannot find a way to change the font of a font asset during runtime.

    All of the TMP text in the UI use the same "Default UI SDF" TMP Font Asset, so I would think if I can figure out how to change the font in the Font Asset, it would change everywhere in game where that Font Asset is used. But I can't find anyway to do that.