Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

(Solved) Escaping some rich text values

Discussion in 'Immediate Mode GUI (IMGUI)' started by joshcamas, Sep 27, 2019.

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,276
    Hello!

    I have some text that shows up in a rich text text area. I have a sort of post processor that modifies a string to add some rich text tags before displaying it on the text area, which works great. However, I want it so any tags that exist before that post processor does not count as rich text, but is escaped.

    How do I do this?

    Thanks,
    Josh
     
  2. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,276
    Looks like I solved it, in a hacky way!
    Code (CSharp):
    1. code = code.Replace("<", "<<i></i>");
    This purposefully breaks any rich text brackets, by placing something that is invisible in between. In this case, italics that have nothing in them :)
     
  3. Amvos

    Amvos

    Joined:
    Apr 8, 2020
    Posts:
    3