Coding tools are important for programmers, and using the right editors and options make a big difference to your productivity.
MonoDevelop is terrible
If you’re not using Windows and can’t run Visual Studio, you will have to put up with MonoDevelop’s problems or use ScriptInspector or some other alternate editor.
- MonoDevelop doesn’t allow word wrap (80 line limit is nice but it greatly interferes with using XML comments)
- MonoDevelop indents code crazily (Does anyone know a way to override this?)
If you have Windows, download Visual Studio Community Edition.
Configuring Visual Studio
Panels to the right
- Collapse all the side and bottom panels by clicking little push pin buttons at the top.
- To maximize viewable area on vertical monitors, move the Toolbox from left to right.
Word wrap on
- Turn word wrap on with Edit menu / Advanced / Word Wrap.
ScriptInspector is an alternative to MonoDevleop and Visual Studio that lets you edit code inside Unity and it works much better than MonoDevelop for most coding on Mac. It is worth the money if you hate MonoDevelop.
- Faster than launching MonoDevelop or Visual Studio, Script Inspector will save you lots of time.
- Mac users: Saving code by hitting control-S might seem weird.
- Note: Unity needs to be able to compile for it to load the first time so make sure you don’t have compiler errors when you try to import it.
- Limitations you will need to use MD or VS to do:
- No debugger
- No refactor.
- No folder search, it has search all open tabs or whole project.
You should use XML comments to take full advantage of Intellisense in your own code.
When you first install Resharper, it needs configuring.
The first thing you’ll notice is that after installing Resharper it underlines lots of variable names with wavy green lines saying that you should name them differently.
- Look at the naming conventions it recommends in the Resharper menu / Options.
The standard naming conventions used in C# Unity source code are based on Microsoft’s C# naming conventions.
You can add some common style rules if your team requires them, such as m_ before private member instance variables such as those used in backing fields for properties and sometimes s_ before private statics.
Fonts & Colors
Resharper adds lots of new colors under Visual Studios Options menu / Fonts & Colors.
The most useful for C# are different colors for members vs statics.
Indenting tabs or spaces
Resharper defaults to spaces (which is definitely inferior to tabs).
- Click Visual Studio menubar / Resharper / Options / Code Editing / General Formatter Style.
- Click Only use tabs.