Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    385
    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:
    124
    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:
    385
    Oooo that's an awesome idea!!!!!