[Tutorial] Using Sublime Text 3 in Unity with IntelliSense Autocomplete

edited in Tutorials
So personally I was looking for a step by step to do this but only found pieces here and there. So hopefully this will help someone out. This was done on OSX but Sublime is cross platform so I am sure it will work on any platform.

Why Sublime Text? Multiple cursors. Once you start using it you can't live without it.

Requirements
http://www.sublimetext.com/3
https://packagecontrol.io/installation

Step1
Install Mono http://www.mono-project.com/download

Step2
Install OmniSharpServer https://github.com/OmniSharp/omnisharp-server

OSX/Linux
git clone https://github.com/nosami/OmniSharpServer.git
cd OmniSharpServer
git submodule update --init --recursive
xbuild

Step3
Install Kulture package from Sublime Package Control
Install OmniSharp package from Sublime Package Control

Step4
Add

{
"auto_complete": true,
"auto_complete_selector": "source - comment",
"auto_complete_triggers": [ {"selector": "source.cs", "characters": ".<"} ],
}

to Preferences > Settings - More > Syntax Specific - User

https://github.com/OmniSharp/omnisharp-sublime#c-language-specific-settings

Step5
Open the root of your Unity project in Sublime. There should be a .sln file there.
Save your Sublime project there. Project > Save Project As

Add

{
"folders":
[
{
"follow_symlinks": true,
"path": "."
}
],
"solution_file": "./ProjectName.sln"
}

to the sublime-project file you just created. ProjectName is the .sln file in your root directory which will be you project's name of course. Note there is also a -csharp.sln file. It is not that one.

Step6
In Unity set Preferences > External Tools > External Script Editor to Sublime Text

DONE
If every was setup correctly you should now get autocompletion and IntelliSense in Sublime. If not let me know :)

Comments

  • edited
    Thanks for this! Intellisense was the only thing preventing me from using Sublime exclusively, and while I was investigating getting it working a while back, I got sidetracked.
  • No problem. I was at a similar situation but luckily it worked this time. Glad it helped :)
  • Thank you for your tutorial! I followed it and everythin works just fine. One thing that I really wanted (which was the reason to follow your tutorial) is that I would like to have an autocompletion for functions comming from Unity as:
    OnCollisionEnter2D, Update, Start, FixedUpdate and so on. What should I do to have this kind of autocompletion?
    Thank again!
  • Well not even Mono provides that right? So the best approach would be snippets. You will have to write them yourself or look in the package control if you can find any.
  • Yes, you're right. Mono doesn't provide it but I wanted to be sure that I am not missing something here... Thank for your fast reply!
  • Hey loet, thanks for you tutorial!

    I've used your info, this tutorial, and the Omnisharp Git, but some reason I can't get Intellisense to show up. (I'm on OSX)

    I've tried a number of different solutions. Installing different versions of Monodevelop, installing all the stuff in different order, reinstalling, double and triple checking all the settings, but I can't figure out what the problem might be. I get some sort of autocomplete, but it doesn't look like Intellisense to me.

    Any idea what might be going on? Or at the very least, a way to troubleshoot this issue would be nice....

    Thanks!
  • Using other tutorials step 4 and 5 above is not made as clear. I would assume the problem is somewhere there. That is where I struggled initially and also though that Intellisense wasn't installed properly.
  • Thanks so much. :D Worked perfectly. It's a bit easier to forget about VS now. Although it will take some getting used to making OSX my main dev OS.
Sign In or Register to comment.