Last active
June 26, 2022 13:52
-
-
Save jfranmora/1eea10afc3a8cd86b3e1a1f4dc7377d5 to your computer and use it in GitHub Desktop.
Extension class to use rich text in Unity Console. https://docs.unity3d.com/Manual/StyledText.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class StringTagExt | |
| { | |
| public static string AddBoldTag(this string text) | |
| { | |
| return text.AddTag("b"); | |
| } | |
| public static string AddItalicTag(this string text) | |
| { | |
| return text.AddTag("i"); | |
| } | |
| public static string AddSizeTag(this string text, int size) | |
| { | |
| return text.AddTag("size", size); | |
| } | |
| public static string AddColorTag(this string text, string colorName) | |
| { | |
| return text.AddTag("color", colorName); | |
| } | |
| private static string AddTag(this string text, string tagName) | |
| { | |
| return $"<{tagName}>{text}</{tagName}>"; | |
| } | |
| private static string AddTag(this string text, string tagName, object value1) | |
| { | |
| return $"<{tagName}=\"{value1}\">{text}</{tagName}>"; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment