Search Unity

Changing the style or font of a word using FindNearestWord()

Discussion in 'UGUI & TextMesh Pro' started by jravasz, Apr 6, 2020.

  1. jravasz

    jravasz

    Joined:
    Jan 29, 2020
    Posts:
    5
    Would it be possible to change the style of a single word or the style of a character from script at runtime?
     
    Last edited: Apr 6, 2020
  2. jravasz

    jravasz

    Joined:
    Jan 29, 2020
    Posts:
    5
    In case anyone was wondering the same in the future my solution is the following:

    I've got the index of the nearest word using FindNearestWord and using Substring I've inserted a font tag in front of the text to the text variable of the TextMeshPro component, than using Substring I've closed the tag after the word.