Search Unity

TextMesh Pro How to remove underline from TMP_Text from script

Discussion in 'UGUI & TextMesh Pro' started by sushanta1991, Jun 9, 2018.

  1. sushanta1991

    sushanta1991

    Joined:
    Apr 3, 2011
    Posts:
    305
    Hi I have found solution to add underline in runtime but i didn't found any solution to remove underline from script.

    i can assign underline like this but how to remove underline?
    Code (csharp):
    1.  
    2. element.fontStyle = TMPro.FontStyles.Underline;
    3.  
    can anyone please help me with this?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Bit-wise operation to remove the underline.

    Code (csharp):
    1.  
    2. element.fontStyle &= ~FontStyles.Underline;
    3.  
     
  3. sushanta1991

    sushanta1991

    Joined:
    Apr 3, 2011
    Posts:
    305
    Thank you so much @Stephan_B , learned a new thing! I would also like to mention that Text Mesh Pro has been a great help. Thanks for creating TMP.
     
    Stephan_B likes this.