Update: These files are outdated please install them from package control instead. See this post for details.

I think sublimetext 2 is currently the best text editor available. I have been using it for awhile now and really love it. I thought I would share some smalls additions I have made to make it easier to use while working with Unity3D.

Here is a link to my C# language file which adds all the Unity keywords, built-in functions, and types for syntax highlighting. It also adds function name highlighting but, but its not perfect and some “else if” statements may be highlighted slightly incorrectly. C#.tmLanguage

Update: For JavaScript highlighting here is a language file. JavaScript.tmLanguage

Also here is a port of my color scheme Candy Mountain for SublimeText 2. Candy Mountain

Screen Shot:

  • Amey

    December 23, 2011 • Reply

    Thanks, this'll prove useful. Just recently switched to Sublime Text 2 myself, thought I'd look around for a plugin for Unity, and stumbled across your post!

  • Damien

    January 20, 2012 • Reply

    Beautiful, thanks for doing the language file!

  • James

    February 19, 2012 • Reply

    How do you install new syntax definitions? I can't find anywhere that explains it?

    • Jacob

      February 20, 2012 • Reply

      It depends on what platform you are using. But basically you just have to overwrite the file that is already installed. On windows you can find it in C:Users/youruser/AppData/Roaming/Sublime Text 2/Packages/C#. just look around in your install until you find a folder that is something like that.

  • Btiger

    February 20, 2012 • Reply

    Thank you for the C#.tmLanguage file, is this support Unity 3.5?

    • Jacob

      February 20, 2012 • Reply

      I'm still using Unity 3.4 but I think this file should work fine with 3.5 at least mostly. I'm not sure if any new keywords were added, but yeah this will work and in the worst case maybe a couple of new keywords will not get highlighted.

  • Seb Fehr

    February 20, 2012 • Reply

    Thanks for this, really. Sublime is well . . . sublime and I work with unity full time so this a big deal for me.

    Are you aware of any solution to get unity to navigate to the correct line from the Debug Log?

    • Jacob

      February 20, 2012 • Reply

      Not at the moment. I just navigate to the outputted line manually. You could look through the sublime docs and see if there is commandline option to open a file at a specific line and add that command to the settings of Unity, but I'm not sure such a thing exists. You could also look into how it was achieved with notepad++ and see if you can adapt it to sublime. Automatically navigating to the line is something I would find more annoying then usefully so I'm not really interested in getting it working. But if you happen to find a way feel free to comment back here and I'll add a reference in my post.

      • Jacob

        March 9, 2012 • Reply

        I take that all back. I just got it to work and it is quite helpful. Post with all the details, as well as a new Sublime text plugin that lets you right click words and search the Unity script reference coming after I get some sleep.

        [WORDPRESS HASHCASH] The poster sent us '0 which is not a hashcash value.

  • Vaclav Vancura

    February 23, 2012 • Reply

    Thank you for the release!

  • EdgarAllen

    March 13, 2012 • Reply

    Ooo thanks. I'm not a big fan of monodevelop. Being able to use sublime pleases me so much.

    One question though, is there a way to have the unity c# projects open in the side bar like in monodevelop?

    Or is there is a better workflow for opening other scripts than alt-tabbing back to unity and double clicking the file or using cltr+o and navigating manually?

    • Jacob

      March 13, 2012 • Reply

      Um you might want to hold off on using the file listed here. I have been working on creating more official sublime text packages for supporting unity and getting them included in sublime’s package control.

      I just requested the changes be made on the package control channel this morning and they have not been accepted yet which is why I have not updated this or the other of my posts. You can wait for them to be included in package control or get them early on my git hub page here:
      https://github.com/UnicornForest

      or you could use these older files.

      as for your question about projects files showing up in the side bar… I don’t currently have a better work-flow then what you describe but I’ll look into how sublimes projects work and see if I can write a plugin for that as well but no promises.

      • Jacob

        March 13, 2012 • Reply

        Actually if you have all your scripts under 1 folder (it can have subfolders with more scripts) you can just drag that folder from explorer into anywhere in Sublime and it will create a ad-hoc project showing all the scripts and folders in the side bar.

        Its really easy!

        • EdgarAllen

          March 14, 2012 • Reply

          Thanks for the update files. That'd be great if they are added into package control soon.

          Doh! I should have thought of that. I use that same work-flow for other things. Dragging my scripts folder over will do just fine. Thanks again.

          Cheers,

  • Tom

    May 2, 2012 • Reply

    This is good stuff. One question though, is there some way to get smart autocomplete? That is have autocomplete find entries outside of the current file? So if I type 'Vector3.' I get a list of the properties/methods available on Vector3?

  • Ben

    May 21, 2012 • Reply

    Thanks for doing this Jacob. Quick question: when this is set up properly, will Sublime Text autocomplete syntax (intellisense style) like Monodevelop does? For instance, if I type a class name that I've made, like GameManager. is it possible to get Sublime Text to show me the available methods like it does with built in Unity classes?

  • computer repair

    May 27, 2012 • Reply

    very good post, i certainly love this web site, carry on it

  • Gavalakis Vaggelis

    July 19, 2012 • Reply

    Thanks for all info here. I'd also like to know if it is possible to have autocomplete like Tom said 2 posts above.
    Thanks a lot for this.


Leave a Reply

Your email address will not be published. Required fields are marked *