Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. We're excited to be bringing you the newest Unity features, news, demos, and we've even got some special guests from some of the industry’s most storied franchises. Set a reminder to tune in on YouTube here
    Dismiss Notice
  3. Unity 2018.3 is now released.
    Dismiss Notice

Syntax Highlighting for Text Editors

Discussion in 'Extensions & OnGUI' started by joshcamas, Jan 6, 2019.

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    443
    Hello friends :)
    I'm wanting to make a python code editor in unity, and thus I'm looking to build a syntax highlighter ^_^

    My current solution is to essentially build it from scratch, without using the text editor as a base. This makes some things easier, however it means all functionality (undo/redo,selection,copy/pasting,etc) needs to be reimplemented, which isn't the funnest. So... I'm wondering if I can use the text editor as a base and then build features on top of that. (Mainly syntax highlighting)

    I know there's a way to do markup with text editors, but I also know that the markup editor is sort of not meant for that, since the user can edit the markup content.

    Any thoughts?

    Josh
     
  2. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    139
    Maybe using a Webview is an option (private API)? You could use existing syntax highlighters for that and most of the work is reduced to the integration into unity.
    This project uses a webview for displaying markdown files:
    https://github.com/Sirithang/UnityMarkdeepViewer
     
    joshcamas likes this.
  3. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    443
    Oooo that's an awesome idea!!!!!