• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
2
Question by greggman · Jun 07, 2016 at 09:04 PM · guitextlabel

How do you escape the angle brackets in rich text?

I saw this question but this example didn't really require a real answer.

Let's assume escaping worked the same as HTML. Then I could do this

  string msg = @"Insert your message here.

  You can use rich text like

        this word is <color=red>red</color>

  which will produce

        this this is <color=red>red</color>";

  GUI.Label(msg, someStyleWithRichTextTrue);


Which when displayed the first color pair would show the codes and the second the result.

So, is there a way to escape the angle brackets in rich text?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by ij · Aug 15, 2016 at 06:37 PM

Put something right after the opening angle bracket:

 this word is <<b></b>color=red>red<<b></b>/color>
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by DynastyV · Oct 10, 2017 at 06:55 PM

There still doesn't seem to be a way to escape the angle characters in rich text. I ended up just replacing every '<' with this unicode character: http://www.fileformat.info/info/unicode/char/3008/index.htm and every '>' with this unicode character: http://www.fileformat.info/info/unicode/char/3009/index.htm

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
-1

Answer by FortisVenaliter · Jun 07, 2016 at 10:09 PM

Here are the first three google results, all of which answer your question:

  1. The RTF Cookbook: Characters, Escapes, and Character Commands

  2. ASCII-RTF Reference Table

  3. The full RTF specification, with the Unicode section covering escape characters

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image greggman · Jun 07, 2016 at 10:26 PM 0
Share

You realize I'm talking about Unity3D right? It's has a feature called "rich text"

http://docs.unity3d.com/$$anonymous$$anual/StyledText.html

Which has nothing to do with .RTF

avatar image FortisVenaliter greggman · Jun 08, 2016 at 02:15 PM 0
Share

Ah, my bad. I thought Unity did use the RTF specs for it's rich text.

avatar image
0

Answer by zet23t · Apr 21 at 12:36 PM

I found out that this is working too:

 str.Replace("<", "<\u200B")

The \u200B is a invisible unicode space character and it will prevent that the richtext parser of Unity is able to interpret it as a valid richtext tag, which makes it displayed as raw text.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

86 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Assigning a variable to my label 1 Answer

How can I make a GUI Label disappear after a certain amount of time? 2 Answers

UI Text Editing Problem, What's Wrong? Need Anybody to Assist 1 Answer

Connect C# script with GuiText 1 Answer

How to make text appear in script? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges