Search Unity

Support Html tags in text?

Discussion in 'UGUI & TextMesh Pro' started by andyz, Jun 10, 2019.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,277
    The rich text support adds a small amount of formatting (more in TextMeshPro) but is there any reason html tags are not supported as an option?
    We have a lot of text from sources where html text is used
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    There is no plan to support HTML tags specifically. Many of the tags used in TMP are the same as HTML such as <b>, <i>, <br>, etc.

    What specific tags / functionality are you specifically looking for?
     
  3. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,277
    Did not know <br> supported as not in doc (http://digitalnativestudios.com/textmeshpro/docs/rich-text/)
    Bold is sometimes done as <strong> in html annoyingly
    But also lists <ol><ul><li>
    Other tags could be ignored rather than being displayed.

    But I appreciate most of this could be handled with clever string tag replacement and this is a special non-game case I have, though would be good to allow more common html tags in future

    (Unity's pre-TMP text is really lacking!)
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Adding an alternative form for Bold like <strong> would be trivial and something I'll add for the next release.

    Tables are more complex as these involve complex layout so no plans for those in the shorter term.

    Simple alternative tags like <strong> can be added so please provide me a list of what you need there.

    UI.Text will soon(tm) be moved into the Legacy category and ultimately replaced by a TMP based replacement. Migration from TMP to this newer component is most certainly planned.
     
    ThisIsDangerous and andyz like this.
  5. UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    Joined:
    Apr 7, 2019
    Posts:
    11
    hello @Stephan_B , can you take a look at this post please? you may have a simpler solution to set up for me =)
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What are you looking for specifically?
     
  7. UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    Joined:
    Apr 7, 2019
    Posts:
    11
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Have you take the time to look at example 17 - Old Computer Terminal included in the TMP Examples & Extras?

    This is an example of how to achieve a Typewriter style FX where you can use rich text, have proper layout and avoid GC allocation resulting from string concatenation.
     
  9. UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    Joined:
    Apr 7, 2019
    Posts:
    11
    @Stephan_B Thank you for your quick reply =)
    I didn't know, i never use TMP ...
    but, Is TMP same as UI Text?
    Do you have a script that does the same thing but with a UI Text?
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    TextMesh Pro (TMP) is the replacement for UI.Text which provides improve text formatting and layout with over 30 rich text tags supported.

    UI.Text is no longer on active development whereas I continue to make further improvements and feature additions to TMP.

    Some of the functionality that makes this possible is part of TMP and not available in UI.Text.
     
  11. UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    UDN_ef4a5413-8457-4652-a34b-2c29cf75fd7f

    Joined:
    Apr 7, 2019
    Posts:
    11
    @Stephan_B Ok I understand, thanks for your reply
     
  12. gsshewalkar

    gsshewalkar

    Joined:
    Aug 6, 2020
    Posts:
    4
    @Stephan_B , can we add tables (made of rows and columns) in TMP?