This seems similar to http://forum.unity3d.com/threads/monodevelopment-fails-to-open-scripts-directly-from-unity.367531/ but I am using native Ubuntu (not Gnome). When I open a C# from Unity it launches Monodevelop but it is as if it never gets passed the file argument and it just opens as if I launched it normally. Then I have to open the file manually in Monodevelop. I have tried to use the monodevelop (builtin) as well as install monodevelop from the repo and no go. Interestingly, if I run monodevelop (from the repo) on the command line and pass a file argument I experience the same behavior.
Granted, I think this is actually a Monodevelop bug but figured this niche community may know the answer, I searched the internets but no luck.
So Monodevelop standalong (non Unity) is actually working from the command line. Not sure why it wasn't working before. After updating to latest build (5.2) the internal editor doesn't launch anymore but Monodevelop standalone does. It still doesn't open the files though. http://docs.unity3d.com/Manual/Preferences.html The link above says that the "External Script Editor Args" option is Windows only but I feel like that is the issue. I also use Fish and think that may also be the case. I did try switching my default shell back to bash with `chsh` but no go. Just talking outloud here. Really want to get this working.
Ahh, I just installed Visual Studio Code for linux and it doesn't work either but it leaves a hint behind. It says the file name it is opening is QuitApplicationScript.cs" /home/elijah/projects/unity/New Unity/ Project/"/home/elijah/projects/unity/New Unity Project/Assets/Scripts Notice the " in the path and the duplication of the path. See screenshot for exact formatting.
Okay, it works with Visual Studio Code if I change the "windows only" External Script Editor Args from "$(File)" to $(File). However, $(File) does not work with monodevelop so VSC will have to be it for now. This is using Fish if it matters.
Having the same issues, MonoDevelop(Bulit-In) doesn't work, but /usr/bin/monodevelop doesn't open files. If you run `man monodevelop` you'll see that it doesn't take a file as an argument. However, you can run the prepackaged monodevelop from its location (e.g. /opt/Unity/MonoDevelop/bin/monodevelop) and it will run with a ($File) arguement. The only problem I'm having now is the errors coming up in the prepackaged monodevelop when closing files: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) [0x00000] in /var/tmp/portage/dev-lang/mono-4.0.3.20/work/mono-4.0.3/external/referencesource/mscorlib/system/throwhelper.cs:94 at System.Collections.Generic.List`1[Mono.TextEditor.TextEditor+EditorContainerChild].ForEach (System.Action`1 action) [0x0006d] in /var/tmp/portage/dev-lang/mono-4.0.3.20/work/mono-4.0.3/external/referencesource/mscorlib/system/collections/generic/list.cs:597 at Mono.TextEditor.TextEditor.ForAll (Boolean include_internals, Gtk.Callback callback) [0x0000d] in /home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextEditor.cs:248 at Gtk.Container.Forall_cb (IntPtr container, Boolean include_internals, IntPtr cb, IntPtr data) [0x00031] in /var/tmp/portage/dev-dotnet/gtk-sharp-2.12.21/work/gtk-sharp-2.12.21/gtk/generated/Container.custom:168
same i cant open files with mono and if i manual it i get errors is ther some Notpade(text editor) that has c# sytax and meybe possiblity to have suggestion implementation so i can exaple add all unity comands to suggestions so when i thy Phy it offers me Physics or any workable suggestion or am i doomed and must swich back to ubuntu I think on Fedora it has somthing to do with newer mono or somthing
I was pissed off with same problem. I tried to search but didn't find anything on forumes. So I turned to visual studio... VS is very easy to integrate with unity and works as good as monodevelop. here is how to integrate VS with unity:- #STEP 1 install VS and install the Legacy C# Support extension(by From within Visual Studio Code, you can use Quick Open (Ctrl+P) and paste "ext install omnisharp" then press Enter.) OR If you have it and you are using the preview C# extension, please uninstall it and install the Legacy C# Support extension.(by From within Visual Studio Code, you can use Quick Open (Ctrl+P) and paste "ext install omnisharp" then press Enter.) #STEP 2 Clone the VScode from here- https://github.com/dotBunny/VSCode/ OR Open up a console and do a clone of the repo to get the plug-in source code. git clone https://github.com/dotBunny/VSCode.git #STEP 3 Extract the VScode and put it in your unity project under Assets/Plugins/Editor/ directory. It is important to make sure that the VSCode.cs file is placed under an Editor folder in the project. An example of this arrangement would be placing the file in /Assets/Plugins/Editor/VSCode.cs and install required debugger and tools extension by unity from VS and ENJOY GAME MAKING... ;-)
Spaces in the project name /location effect this on Linux, at least with my Ubuntu setup...never the less it is frustrating...
The problem is that Unity attempts to open the monodevelop with an invalid argument. The first argument it uses is "--nologo" which is deprecated in monodevelop but safely ignored anyway The second argument is the sln file which works fine The third argument is the filename + line number in this format <filename>;<#> which would also work fine if not for the fact that Unity sends line number "-1" which being an invalid line number causes monodevelop to reject the argument entirely. Unity should be opening with line zero if there's no specific line number so this is a bug. I wrote a short bash script that you can inline to work around the problem: #!/bin/bash nologo="$1" sln="$2" fileLine="$3" file=`echo "$fileLine" | cut -d';' -f1` line=`echo "$fileLine" | cut -d';' -f2` if [ $line = "-1" ]; then line=0 fi monodevelop "$sln" "$file;$line" Save the above script as "monodevelop" in your home directory and set it as executable. In Unity Edit->Preferences->External Tools->External_Script_Editor select it by using the "Browse..." option in the drop down. Unity will read the file's name and "think" the file is the actual monodevelop binary and snap the selection back to "monodevelop" only it will now work like it's supposed to.
Dude! You're a genius. I just tried it out and works well. Other than it still opens it up in a new window each time rather than opening a tab within already open sln.
Thanks @ferreusveritas I played around with the bash a little, tried to find a way to attach same process id to it. I wanted to try connect process manually through the script, ended up failing and overwrote solution parameter. (Uhm... I tried to kill the process and open new one at this point ) I noticed that without solution, window would keep opening file tabs. So the process is already linked... Then I though how about just open a solution, and if it's open, dont mention the solution. The result, it works! At least for me, need additional testers. Code (csharp): #!/bin/bash #ferreusveritas code nologo="$1" sln=`echo "$2"` fileLine="$3" file=`echo "$fileLine" | cut -d';' -f1` line=`echo "$fileLine" | cut -d';' -f2` if [ $line = "-1" ]; then line=0 fi #Advis code PID=`ps aux | grep "/usr/bin/monodevelop" | grep "bash"` if [[ "" != $PID ]]; then monodevelop "$file;$line" else monodevelop "$sln" "$file;$line" fi Mentioned thread in https://github.com/mono/monodevelop/issues/4649
Tried checking solution name, which will now open a new solution if you use multiple Unity editors. However, when you try to open a file from older solution through editor, it will send it to the newer window. The process is attached to newer window and doesn't renew back to old window as monodevelop seems to forget it had an open window for the solution. Code (csharp): #!/bin/bash #ferreusveritas code nologo="$1" sln=`echo "$2"` fileLine="$3" file=`echo "$fileLine" | cut -d';' -f1` line=`echo "$fileLine" | cut -d';' -f2` if [ $line = "-1" ]; then line=0 fi #Advis code PID=`ps aux | grep "/usr/bin/monodevelop" | grep "$sln"` if [[ "" != $PID ]]; then monodevelop "$file;$line" else monodevelop "$sln" "$file;$line" fi Seem to work and open solutions in 2018.3.3f1 and 2019.2.0a4 versions. Older versions of Linux editor doesn't open solution correctly in 2018.3.2f1 for my current monodevelop version(7.7 build 1869). Edit: Updated code in Monodevelop not opening files
Hey tried out your scripts and it works well with both my projects in Unity 2018.3.0f2 and 2018.3.6f1. Thanks heaps. Will try give Monodevelop a second change. I do still get Monodevelop freezing on me randomly however. Even xKill wont work. But at least I can open scripts within the same project now
I've had the same problem. But I guess that for me the reason was quite different. I simply had a space in the path where the file was located, and monodevelop interpreted that as two separate inputs.
you sir are a legend really glad to be able to have a stable editor, that actually works and feels nice.
I discovered that when the project name has spaces, it does not open the files, it happens the same if any folder or the file to edit contains spaces
since we're talking about mono develop, has any of you guys, managed to get monodevelop "reading" code from other packages? example: Cinemachine or photon. for some reason, despite having the references added, but MonoDevelop does not appear to recognize code from these packages, which i assume is because they're code is in DLL format?
Hmm... dont have any imported dlls to check that... I wonder if other configs might get it to work. But I improved my bash script. It will now open solution only once. Then it opens new files in monodevelop if have to. I noticed some minor things after modifying the file. 1. I noticed these scripts stay as "zombie" processes (status) until Linux editor is closed. It just takes some more ram out of your system. The reason for it might be that Unity is just fine what it gets there and exits the main ide attach process and uses some other way to keep the connection (I think visual studio supports something like that). Testing "zombie" status processes: Open file from unity, first process stays sleeping, next one zombifies. First one zombifies when you close monodevelop. 2, Process name and command sometimes trunctuates. If you wait for monodevelop to load the file, next time you open a new file process name and command might be trunctuated. Unity opens the ide and script waits for monodevelop to close and then it just zombifies. Next processes will all just zombifie if ide is still open. If you wait monodevelop to open the file, it shows up the first process in the list and the full command, but the next is most of the time trunctuated as the process to open the file happens too fast. I presume it depends on your pc then where it trunctuates. But now monodevelop should work a lot better! Code (CSharp): #!/bin/bash #ferreusveritas code nologo="$1" sln=`echo "$2"` fileLine="$3" file=`echo "$fileLine" | cut -d';' -f1` line=`echo "$fileLine" | cut -d';' -f2` if [ $line = "-1" ]; then line=0 fi #Advis code PID=`ps aux | grep "/usr/bin/monodevelop" | grep "$sln"` if [[ "" == $PID ]]; then exec -a "Monodevelop Unity" `monodevelop "$sln" "$file;$line"` else exec -a "Monodevelop Unity" `monodevelop "$file;$line"` fi Edit: Fixed some typos and removed unnessessary comments from script... The fix was... exec, but I kept exec -a "Monodevelop Unity" if the process shows up in a process list at some point so I can see it better.
Would it be possible to make this work on Windows as well? So far I was still able to use the MonoDevelop version which can be installed via the Unity 2017.4 installer up until Unity 2020 by setting it up as External Script Editor. However, when I recently tried to upgrade to Unity 2021 I discovered that something seems to have changed in the way MonoDevelop is detected and/or called. For comparison, here's how the "External Tools" menu look in 2020: And here's how it looks in 2021: Note that it says "(internal)" despite support for MonoDevelop being officially deprecated since 2018.1 as well as the options to generate .csproj files missing. The result is that when double-clicking a script file in the Project view to open it, or double-clicking a Console message to jump to the relevant line, etc. open a new MonoDevelop instance each time (without actually opening the project) instead of just switching to the already open instance and selecting/opening the tab for the respective script file (and navigating to the correct line number, in case of Console messages). This would sadly make it quite impossible to work effectively with MonoDevelop anymore going forward. I've already opened a bug report (case 1348156) but got told that there's currently no known workaround and that I should try asking in the forums where I found this thread. Sadly I don't have enough experience with Linux environments to port this bash script to Windows myself, so any help with this would be hugely appreciated!
I also submitted a bug report for Linux and I got an answer saying "we are not able to reproduce the problem", which proves that the qa employee didn't even try otherwise he/she would have noticed that MonoDevelop has been definitively ditched by Unity... @LeonhardP
Case 1332055 I'm afraid I didn't write clearly enough that the problem happened with MonoDevelop ; I put it in the description but I should have put it in the title... Definitely not clear enough... Forum thread: https://forum.unity.com/threads/cas...tion-generated-after-script-creation.1100020/