public class Html2UnityTextConverter
public static string Convert(string text)
bool startsWithNewLine = text.StartsWith("\n");
bool startsWithParagraph = text.StartsWith("<p>");
if (startsWithNewLine == true)
text = text.Substring(1);
else if (startsWithParagraph == true)
text = text.Substring(3);
text = text.Replace("<strong>", "<b>");
text = text.Replace("</strong >", "</b>");
text = text.Replace("<em>", "<i>");
text = text.Replace("</em>", "</i>");
text = text.Replace("<p>", "\n");
text = text.Replace("</p>", "");
text = text.Replace("<br>", "\n");
text = text.Replace(" ", " ");
public static void Main()
string text = " <p><ul><li>Test1 <strong>Strong test</strong><b>Strong test2</b> </li><li>Test2</li><li>Test3</li></ul></p>";
Console.WriteLine(Html2UnityTextConverter.Convert(text));