Unity will not generate sln and cproj files, making new changes to code not available to something such as the Omnisharp server
Additionally, “Reimport All” and “Build” do not seem to generate .sln or .cproj files either.
I use omnisharp-vim, and the current workaround I have is to switch my external editor to VSCode and open a file with it through Unity to get VSCode to generate the sln and cproj files, but it’s really, really irritating as I basically have to interrupt my development every 2-3 hours to do this.
Unity 2017 for Linux seems to generate sln and cproj files just fine.
This seems kind of strange. Unity 2017 was working with the exact same external editors and created the sln file without doing any fooling on my part.
Why would Unity care at all about the editor/attempt to maintain a list of editors that it thinks can handle the sln and csproj? It seems like it should just be an option in the External Editor preferences to tell Unity to generate an sln/csproj file or not. Wouldn’t it be more error prone to try to guess if a particular binary wants a sln or csproj file? There are a lot of editors for Linux that use Omnisharp/Omnisharp-roslyn.
How does unity determine this information? By name? If I changed my external editor script (which issues a command to open my editor and a few other things) to code, would Unity generate the sln?
The reason that Unity knows/cares about the editor is that different editors have different ways to pass them the solution/file/line when launching them.
The reason that the solution and projects aren’t always generated is that it takes nonzero time, and we want to avoid making people wait for the generation of files they’re never going to use.
However, maybe it will be reasonable to add a way to generate project files for an “unknown” editor.
Just as an FYI, I was very happily using the Linux editor for almost 3 years before this change. This issue has forced me to switch back to the Windows editor. Needless to say, I’m pretty unhappy with it.
I would greatly appreciate it if this option would be added in the future or if Unity for Linux was modified such that it always generated .sln files. The vast # of editors available for Linux and the nature of it’s open ecosystem should mandate that Unity be flexible in this regard.
While it is “non zero” time to compile an .sln, it is barely noticeable in projects of any size. It’s usually a fairly small fraction of the overall compile time. It’s not like I was suddenly blown away by Unity’s compile speed when it no longer compiled the .sln file in my fairly large project.
I can understand the engineering aims but I think this is unneeded optimization that does more harm than good.
It’s fine to integrate directly with supported editors such as VSCode and VS, but it seems strange to then prevent editors Unity has no idea about from working with an .sln file when you already provide configuration options to pass the current File/Line information in a particular way.
Just wondering about one small detail, say I am using VS Code and a Unknown editor, and I have used Unity’s VS Code integration to generate sln/csproj files:
- Now I switch to the unknown editor in Unity preference, will Unity continue to refresh these sln/csproj files?
- I believe it should, but how can I verify or initiate the refresh?
I am asking because we have to use the unknown editor for following reasons:
How on earth is unity even trying to determine which editor is in use? Using the name?
If unity has the ability to generate the appropriate csproj and sln files, this needs to be exposed to the user so we can actually work on our projects.
I’m trying to develop on linux, and it’s quite literally impossible because no solution or csproj files are being generated. What am I supposed to do? Write them by hand?
This issue is that Unity Editor expects the file used to launch VSCode to have a specific name. It seems that unity will only trigger the .sln/.csproj generation routine if the filename matches a hard-coded value.
Specifically, creating a symlink named “code” that opens VSCode fixed this issue for me. The normal binary was named “visual-studio-code”, which Unity didn’t recognize as VSCode.
Unity devs may want to consider a more sophisticated method of determining whether the selected external editor is VSCode, VS, etc.
Yes, I had figured out the same thing and it’s such an unfathomably stupid decision I simply have no idea how on Earth someone thought it was a reasonable way to do things.
Unity’s Linux support seems to be nearly mostly a farce since it seems like there is hardly ever any input from any official unity people. Making your program buildable on Linux and then otherwise just dumping it on the community and forgetting about it is not how you add Linux support. It’s absolutely pathetic that unity will literally generate projects that you can’t even work with on Linux without using a specific editor.
Thank you guys for the workaround, I was using VSCode Insiders which has a different executable name and wouldn’t make Unity generate project files. Please upvote that suggestion so that we can have a decent behaviour with any code editor!