- Home /
Unity Linux—Connect to Debugger
Hello Everybody,
I have downloaded and install the Unity Linux beta (5.1.0f3) which running quite nice, and except some crashes here and there, It does what it should. The only thing I cannot get to run is the Mono Debugger. I installed monodevelop
sudo apt-get install monodevelop -y
and if I click on a script file, everything opens as it should, including auto completion and that alike. However I I try to attach to the debugger, I just never works, so I cannot step through the code.
I tried to start the game first and each available process in the list
But all I get is:
Any Ideas how to fix this? Might that be an permission issue?
Answer by Lao2211 · Mar 18, 2017 at 01:44 PM
The answer is in this forum post: https://forum.unity3d.com/threads/solved-dependencies-not-installed.435441/
More than a BUG like the author of that post thinks, I would say that this happens when you have MonoDevelop already installed before you installed Unity.
In resume: first run "sudo apt-get install mono-complete gnome-sharp2". Then, every time you reopen the editor you will have to right click the Project, in the left, not the solution, and then "options" and change Mono version to 4.5. As the default, at least for Ubuntu 16.04 is "3.5 (not installed)", and for some reason close and reopen Unity Editor causes MonoDevelop to reload the solution and forget your changes to project options, so Mono version resets to 3.5.
How to debug: you need to have Unity Editor open, do not run your project or you will miss all breakpoints in the Start() method of your scripts. Then switch to the MonoDevelop window, click the play button, and in the dialog to attach to process select "Attach to Unity Editor" the last option, not the first one. Then switch back to Unity Editor and run your game. You will trigger all breakpoints, including the ones in the Start() methods.
Answer by graslany · Aug 27, 2017 at 06:59 AM
Regarding the target framework version and the fact that you cannot set it to 4.5 reliably: the catch here is not about Monodevelop "forgetting" things. It's the Unity editor that completely rewrites the .Net project file (Assembly-CSharp.csproj and the like). You can make a simple test to check that: before opening anything, open the project file (Assembly-CSharp.csproj if you're doing C#) and add some modification into it (e.g. add some spaces or comment using a text editor like gedit or kwrite). Then start the unity editor and open your project file in a text editor again: your modifications are gone.
This because the Unity editor uses its own compiler (if I recall correctly... but I looked into it a while ago so you should not take my word for it), and it does not really care about what the .csproj file says. This .csproj project file is automatically generated by Unity so that external tools like MonoDevelop can open it as if it were a "real" .Net solution and know what files are included into it. But once again, Unity does not use this file, and erases it from time to time (when it starts and when you add/remove/move scripts and files I guess).
Your answer
Follow this Question
Related Questions
Run unit tests (nUnit) in debug mode (MonoDevelop) 0 Answers
mono develop debugging stops on lines without breakpoints 2 Answers
Monodevelop 5.9.6 not stopping at breakpoints 1 Answer
Why does monodevelop sets "pink", nonfunctioning breakpoints ? 1 Answer
Stepping in MonoDevelop Debugger takes a long time when using buttons 1 Answer