Search Unity

Text Mesh Pro ALL Tag closeout Tag?

Discussion in 'UGUI & TextMesh Pro' started by joedurb, Oct 10, 2019.

  1. joedurb

    joedurb

    Joined:
    Nov 13, 2013
    Posts:
    38
    It would be SUPER convenient to have a Markup tag which can clear all existing tag effects.
    So that any place with shared content, where different users provide different lines, I can easily prevent "Style bleed" I.e.:

    Bob says <B> I like things bold <I> and bold italic'd!
    Suzy just wants normal text.

    I would love to be able to place a <ResetTags> or <cleartags> or <closeall> or </all> or simply </> Tag right before Suzy's text.
    As It stands I believe I need to search for every tag possibly used in bob's line, and sort if closed or not, and then add </B></I>

    Or simply spam all of the closing tags at the end of each line. </color></b></i></size> ,etc.
    Anything like this exist? or a simpler workaround?
     
    Last edited: Oct 10, 2019
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide more insight on the use case?

    For instance, is this part of a chat system where a user would type some line of text where they would be unlikely to close them. You then take these lines and append them to some list where these un-closed tags become an issue?
     
  3. joedurb

    joedurb

    Joined:
    Nov 13, 2013
    Posts:
    38
    some of our mixed-user interfaces are protected by using separate TMP instances. But We have other systems,
    like a group message board. physically displaying the text in our world, one posting after the other for efficiency. where we allow them to use basic tags. but if they fail to cleanup , spills into next article.

    TUESDAY Oct 8:
    bob typed this text <B>loud text.
    </CLEAR>
    WEDNESDAY Oct 1:
    Sally doesnt want this to be bold.

    If I could Clear all tag effects at the </CLEAR> would have simplified this issue.
    Just thought you might handily be able to reset all markedup stuff easily, and hoped there was already a way. a Blank Style?

    Just being lazy probably. searching for all unclosed tags i guess is just (and case insensitivity added):
    if (text.strpos("<B>") > text.strpos("<B>")) text+="</B>";

    But I would think it could be a handy feature to simply return the formatting to the TMP box's original specs.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll try taking a look at this over the new few days / weekend and let you know what I come up with.
     
  5. HappyPlaying

    HappyPlaying

    Joined:
    Nov 3, 2019
    Posts:
    6
    Has this ever been turned into a feature?
    Aka a reset all styles tag?
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    No but this serves as a reminder for me to revisit this once I have a chance.
     
    HappyPlaying likes this.
  7. jamesf42

    jamesf42

    Joined:
    Mar 10, 2023
    Posts:
    10
    I would love this feature. Or even just a way to log warning messages about unclosed tags.
     
  8. jamesf42

    jamesf42

    Joined:
    Mar 10, 2023
    Posts:
    10
    Alternately maybe <page> does this, or could?
     
  9. Czpal

    Czpal

    Joined:
    Feb 2, 2019
    Posts:
    23
    Has this been added? It'd be really helpful if you want to concatenate multiple rich text strings like above mentioned articles or in my case logs.
    I don't want to have to create multiple textmeshpro objects to achieve this. Currently I just slap a bunch of closing tags at the end of every individual string and it works, but is really janky.