If you're defining a function, why have a definition in the declaration? if it was an if statement I could see that, or iterating in a for-loop. If you are hard-coding the value for parameterTwo why include it at all ?

Has there been anything else on this topic? Unity3 does indeed have support for default parameters, and their interaction with MonoDevelop leaves a lot to be desired: it will stop allowing code completion after their usage and will fail to index the class.

Downloaded Unity 3.4.0 today thinking for some reason that there was a MonoDevelop upgrade from 2.4 to 2.5, but I was wrong. And any minor changes that may have come, did not fix this. I'll have to try upgrading MD on its own...

I have found a temporary solution. For example, you use Visual Studio, that works fine with named and optional arguments, as a primary IDE, but switch to MonoDevelop from time to time for debugging. Just switch "target framework" of all your C# projects to Mono / .NET 4.0:

But be prepared that every time you restart Unity, it will change it back to 3.5.

MonoDevelop 2.8.2 doesn't highlight default parameters as errors, but still doesn't allow me to start debugging until I change the target framework, because first it tries to compile the code and fails.

Ive been having this problem recently as well, as the A* Pathfinding Project now uses these default parameters.

The problem im having is that EVERY time i change it to Mono/.NET 4.0 in the options, when i debug the probject(or do anything really that runs the Unity Project) it always gets set back to 3.5

Ive tried force saving on both Mono and Unity..but it always reverts back to 3.5 and its driving me insane, i cant even work on my game because its too frustrating resetting it every 30 seconds when i find a bug and have to debug a few times.

You guys updating your Mono, how did you overwrite it to make Unity use the new one? By default i just had another Mono install...not sure how you set it up to debug into Unity...

Try to not close Unity once it has been launched by MonoDevelop; use its Start/Stop buttons.

UPD: I mean Play button.

Click to expand...

I have nothing but problems with Mono and debugging in Unity, i dont know if im doing something wrong or what.

Step 1) Close Unity
2) Start Debugger from Mono which starts Unity
3) Start Unity project, do debugging.
4) Stop Unity project, make changes to Mono code
5) Unity will now not respond to any input on the Start/Stop buttons, you can do things in the menus, minimize/maximize...but cant start/stop or terminate Unity.
6) Stop the debugger in Mono
7) Kill Unity3d

Sometimes it gets really bad where Unity wont let me kill it, or wont close..it asks if i want to save my Scene i hit yes then it does nothing...never closes so i task manager kill the process. Open up Unity again..BOOM my entire Scene is gone, not just not in Unity..but not in the game folder at all..its totally gone. This has happened MANY times to me and its infuriating, even with just a small prototype scene that takes 5 minutes to setup.

It has exhibited this behavior across two windows installs, so i dont think its my system or something else causing it. I had to reformat a week or two ago and it does the same thing now on a fresh system as it did before on my loaded system.

I came here because I was having some Default Parameter issues as well, and noticed that none of you guys seem to be aware of attaching to the currently running Unity process to debug.

It is much faster and will definitely improve your workflow.

While having unity and monodevelop open, click the "Attach To Process" button in Monodevelop (It's right next to [Debug (F5)]). You can also find the command under the Run toolbar button.

Then select Unity Editor (Unity), there will be a Process ID that will change each time you open Unity, but there should probably only be one process there.

And voila! You're attached and debugging. You can attach to the process mid-game as well, if you need to set something up or examine some odd behavior in the middle of the game itself.

Then, if you hit Stop (Shift+F5), Unity player continues normally, and you can reattach later if you like.

You can even use this method to attach to Development/Script Debugging versions of StandAlone builds or even iOS builds (it attaches over the network if the iOS device is on wifi). I believe it doesn't work for Web Player.

@alexzzzz when you uncheck Build Project in Monodevelop it never builds in Monodevelop and you cannot see errors in Monodevelop. it would be nice it worked like build in unity and show compile errors in Monodevelop.

@genail it is nice script but it does not work for <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> in csproj. is there any way to change target to 4.0 automatically?

I extended the script provided by genail to assemble a small patcher that constantly checks the project folder. It is independent from Unity.
It's my first version of this, so no big features to except

I know this is super old and I responded to it before, but I just was setting up a new project and decided to revisit it.

I ended up creating a new script, which is based on genail's but it's using a secret built-in callback I discovered. It turns out that "OnGeneratedCSProjectFiles" is called on AssetPostprocessors whenever the CS project gets generated. This makes it happen at the correct time: after the solution has been generated, but before it has been opened. When it was using OnPostprocessAllAssets, it would happen too late.

So yeah, just stick this anywhere in your project and you're good to go.

I extended the script provided by genail to assemble a small patcher that constantly checks the project folder. It is independent from Unity.
It's my first version of this, so no big features to except