When installed with Unity on Windows, MonoDevelop uses the Microsoft .Net Framework by default. And Unity uses "a custom build of Mono", as pointed out here.
The language feature that causes compiler error is called Optional parameters and was introduced in C# 4.0
. Now, MonoDevelop projects generated by Unity target .Net Framework 3.5
, which does not support this feature.
If you change target framework of generated projects to .Net 4.0
(in Monodevelop right-click on project, then options->general->Target Framework
), everything should compile fine. But if you make any change to the project in Unity (add a script for example), MonoDevelop project files will be regenerated and your change will be lost.
To workaround this problem, you can download and install a release of Mono for Windows, then configure it as your default runtime in MonoDevelop (Tools->Options->.Net Runtimes->Add
, find the installed Mono release, then hit Set as Default
). Monodevelop will now use Mono
to compile your code, and Mono compiler will not complain about default parameter values.
This should save you some trouble of switching between Unity and MonoDevelop just to check if the code compiles. Tested with Unity 4.5.3f3 and MonoDevelop 4.0.1.