As The last ship sailed towards the distant horizon I sat there watching on a rock My mind slowly drifting away Forming into my... Dreamtale
Unity - Markdown Render for UIWidgets
2019-05-01 / 2 min read

New unity plugin has been released:
markdown render for uiwidgets

What is UIWidgets?

UIWidget is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps. Details could be found at their github page

What does this plugin do?

Just parse and render raw markdown strings into UIWidgets elements.

How to use

    1. You must learn how to use UIWidgets first
    1. Import UIWidgets into your Unity project according to Requirements
    1. Then import this plugin into your Unity project
    1. Embed your markdown element into UIWidgets UI codes just like below:
    protected override Widget createWidget()
        return new MaterialApp(
            title: "Markdown Demo",
            showPerformanceOverlay: false,
            home: new Scaffold(
                body: new Markdown(null, markdownData1,
                    syntaxHighlighter: new DartSyntaxHighlighter(SyntaxHighlighterStyle.lightThemeStyle()),
                    url => { Application.OpenURL(url); })
    1. Adjust your code for better performance.
    1. Enjoy!


  • To use UIWidgets, Unity version must be larger than 2018.3
  • If the markdown string is too long, it would take much more time to parse and render, so async operation is needed and a Dispatcher script is provided to handle this situation
buildThread = new Thread(() =>
        Stopwatch sw = Stopwatch.StartNew();
        if (nodes == null)
            nodes = document.parseLines(lines.ToList());

        if (widget.onParsed != null)
            widget.onParsed(, nodes);

        var elements =;

        // make the callback running on the unity main thread
        Dispatcher.Invoke(() =>

        Debug.Log(sw.ElapsedMilliseconds / 1000f);
    catch (ThreadAbortException e)
  • Also could use in-app webview to handle URL click event to replace Application.OpenURL for viewing web page in your unity application.