In this post I cover some more tips on how to get Unity3D working with Sublime Text.
- How to make sublime jump to the line number of problems found by the Unity debugger. (Windows only)
- I’m also releasing a Sublime Text plugin called Unity Helper that lets you search the Unity script reference from within sublime by entering a keyboard shortcut or by right clicking any Unity class or function. (all platforms)
How to make sublime jump to the line number from Unity debug console
Basically at the time of writing this Untiy3D 3.4 only outputs command line options for the built in editor (monodevelop). The way most other editors have got around this is to write a small wrapper program that replaces monodevelop and passes the command line options on to the users editor of choice. As it turns out the wrapper that was written for Notepad++ works just fine with sublime text and will due the trick. All you need to do is edit a specific ini file with Sublime Text’s details.
You can download a package with the edits based on my configuration (64-bit Sublime Text 2)
My Version, and jump down to step 3.
Or if you have a different configuration or are weary of downloading an exe off of a random blog you can do it yourself starting at step 1.
Go to the Unity Community wiki page for Using Notepad Plus Plus as a script editor scroll down to the bottom to the section that says “How to make Notepad++ jump to the correct line number from the error console” and download and extract the package that is linked there.
Open the extracted folder and find the file named wrapper.ini replace it contents with this:
[Settings] Application=C:\Program Files\Sublime Text 2\sublime_text.exe Arguments="*file*:*linenumber*"
you will need to change the Application line if you are not using the 64 bit version of Sublime Text 2.
Now rename the file UnityExternalScriptEditorHelper.exe to MonoDevelop.exe
Navigate to unity’s install of monodevelop, C:\Program Files (x86)\Unity\MonoDevelop\bin then rename the MonoDevelop.exe that is there to something else like MonoDevelop_Real.exe.
Copy the new MonoDevelop.exe and wrapper.ini from the extracted files to C:\Program Files (x86)\Unity\MonoDevelop\bin .
Set Unity to use the built in editor. [Edit] -> [Preferences…]
Thats it! Now when you double click an error or warning from within the Unity Console window Sublime test should automatically navigate to the corresponding line.
The Unity Helper Plugin
This plugin give sublime text 2 the ability to search and look things up in the online Unity3D script reference documentation. Select any word, class, or function call and then right click and select Search Unity Reference to do a search on the selected term, or select Unity Class/Function Lookup to be taken directly to the script reference page for the class or function. You can also search the Unity script reference from within sublime text by using the keyboard commands: Ctrl + Shift + P then U to find the available Unity helper commands. Preview video with more details coming soon.
Download : Unity Helper
Install : Extract the UniyHelper folder and copy it to the Packages directory of your Sublime Text 2 install (on windows C:\Users\<yourusername>\AppData\Roaming\Sublime Text 2\Packages) Then restart Sublime.