Hi! This is my very first post to the forums here, so I hope I’m asking this question correctly. I’m very new to Unity and coding, so please forgive my lack of knowledge on the subject.
So, as it stands I’m not able to debug any script within monodevelop because no matter what script I have open and no matter where the script is located on my computer, the file “AccountService.cs” pops up in its own tab with 1 build error, ignoring whatever script I’m actually trying to compile. I’ve never attempted to access AccountService.cs prior to this. Not sure why it’s starting to pop up now. Anyway, it’s located in the PhotonNetwork folder and has something to do with Playmaker, but I’m really not sure how. I’ve tried reimporting Playmaker and all of my assets and that didn’t seem to help either.
The error that appears in AccountService.cs is on line 93:
public void RegisterByEmailAsync(string email, Origin origin, Action callback = null) Default parameter specifiers are not permitted
Thank you so much for your help and sorry for being such a nooblet!
Default parameters aren’t supported by .NET 3.5 or older. However, (modern) Unity supports the equivalent of .NET 4.0 (though it’s actually Mono) - so the code you posted should be supported. I wonder if you’re inadvertently compiling for 3.5 or older? I’m not a MonoDevelop User, but I’d guess you can set the .NET / Mono version somewhere under the project properties. Otherwise, I guess you could remove the default parameter in the offending code.
To do that, change this:
public void RegisterByEmailAsync(string email, Origin origin, Action<AccountService> callback = null)
to this:
public void RegisterByEmailAsync(string email, Origin origin, Action<AccountService> callback)
Thanks for responding! So I checked and under the options for Mono (which is version 4.0.1) and the only section I could find that sounded similar to what you were talking about is the .Net Runtimes tab. It didn’t specify which version it was running, though. The only option was “Microsoft .NET (Default)”. I also took a stab at altering the code like you had recommended and it removed the error in AccountService.cs, but gave me two new errors in a file called FsmComponentInspector.cs…
The first is on line 128:
if (FsmEditorGUILayout.HelpButton()) No overload for method "HelpButton’ takes ‘0’ arguments
The second is on line 171:
fsmVar.DoValueGUI(new GUIContent(fsmVar.Name, fsmVar.Name + (!string.IsNullOrEmpty(fsmVar.Tooltip) ? “:\n” + fsmVar.Tooltip : “”))); No overload for Method ‘DoValueGUI’ takes ‘1’ arguments
MonoDevelop is just used as a text editor for Unity. While MonoDevelop does have a compiler Unity uses its own built in one instead. Changing options in MonoDevelop will not change how Unity compiles the code.
For this same reason, there may also be discrepancies between what Unity tells you is an error and what MonoDevelop tells you is an error, though I’ve personally not had an issue with that yet. Of course if I did have that issue I’d definitely want to fix it, but mostly because it’d be annoying rather than because it was changing the output.
When you go over to Unity, does the error show up in the console there? (Go Window → Console to open it, then press the Clear button. Anything left should be current compile errors.)
Thanks for your response, angrypenguin! So as it stands there are no errors in Unity’s console window. Unity does, however, read errors with another script I would like to edit and plug in, but Monodevelop doesn’t let me run the debug on it so I’m not sure what the problem is.
Unity’s console will still tell you what the errors from its own compiler are. If you open the console and double click on an error it should open MonoDevelop to the line that it came from, and the console will often give additional information that the status bar error report will not, such as a stack trace.
It’s still a pain that MonoDevelop is so far off the mark for you. Unfortunately I can’t say I’m surprised. What you could try is Assets → Sync Monodevelop Project, as it could be something messed up in the generated project file rather than in MonoDevelop itself. On the same note, make sure that anything you’ve changed to try and fix it was changed for the project, not in the global settings. (MonoDevelop stores a lot of settings per-project. It is necessary in some cases, but its nonetheless often confusing when you change something and… nothing happens, and there’s no explanation. It’s further compounded with how buggy the program either is or used to be, in that I’ve sometimes thought “crikey, it’s broken again!” and thus not even bothered to look further.)
Hah, yeah was wondering if I should just keep tabs on the errors on the console. Unfortunately whatever the problem is keeps Unity from linking me directly to the issue in Monodevelop. I can still read the details on the console window, but the debugging tools of an IDE would be nice. I have VS Express and would prefer to work on that, but from what I’ve seen there are compatibility errors even though I’ve seen other people use it for Unity code Maybe I should look into that? Seems like a lot of people aren’t fans of MonoDevelop so maybe I should! Oh, and you mentioned how MD stores settings per project and I actually hoped this was the case so I could just start a new one, but it doesn’t seem to matter what script I’m working on MD is just obsessed with that file.
A project is a bunch of files. Changing the individual text file you look at won’t make a difference. When it builds/debugs it uses all files in the project.
Visual Studio Express can be used, but debugging capabilities are limited. By default Unity doesn’t integrate with Express at all. It opens it and… that’s about all.
A forum member did make and share a 3rd party tool that does some VSE integration - it at least managed keeping a project together and made go-to-line work. It does not allow full debugger integration. For that you need to use Unity’s built-in MonoDevelop support, or there’s at least one (paid) plugin to integrate with Visual Studio Professional.