|
I started editing a new C# script in MonoDevelop, and pressed the "Build Project Assembly" button (F7). This caused it to now go into another C# library package I've had working for a while, and drop the following error dozens of times on function definitions with optional parameters:
The errors are only thrown in MonoDevelop. When you save it and switch to the Unity editor, it compiles and runs the code fine, as I've been using that package's scripts for weeks. I'm thus only now discovering that MonoDevelop doesn't approve, possibly because it's the first time I hit F7 on a C# file instead of JS, so I presume that it compiles all scripts of only the language of the script you're editing. Google has it that C# only started accepting default parameter specifiers after version 4.0. So is there a discrepancy between the assembler of Unity and that of MonoDevelop, such that the former accepts post-C#-4.0 conventions and the latter doesn't?
(comments are locked)
|
|
The latest version of mono supports this just fine. If you're using Mono Develop 2.8x and you're still getting this problem you might want to make sure you're actually using the .NET 4.0 compiler. To do this change the setting in the Project options:
Indeed mine was set to 3.5 by default. Good one.
Feb 12 '12 at 05:34 PM
blitzen
Is there a way to make this change permanent? It seems to reset this sometimes :s
Jan 15 at 04:57 PM
The Oddler
I can confim this. .NET 3.5's alternate to default parameters is member overloading. As far as changing it back I think Unity is doing that. You shouldn't have a problem if you build in Unity even though MonoDevelop may be giving you an error. Member Overloading - http://msdn.microsoft.com/en-us/library/vstudio/ms229029%28v=vs.100%29.aspx
Jan 16 at 09:10 PM
doublethink
True, no problems in Unity. Though it's still annoying in monobehaviour. I mainly get this when using other libraries, and it's a pain to change all their default-parameter stuff to member overloading :P
Jan 16 at 09:29 PM
The Oddler
(comments are locked)
|

