Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Editor integration improvement

Discussion in '2018.2 Beta' started by bitinn, Jun 4, 2018.

  1. bitinn


    Aug 20, 2016
    Hi all,

    There is a very subtle yet common issue with VSCode and Unity integration:

    - By default, if Unity detects a known editor, it will try to setup the right command line call by itself.

    Screen Shot 2018-06-04 at 16.00.23.png

    - This is all great, until you have following setup:

    1) you are using a custom workspace: which Unity will overwrite because its command line call to VSCode includes a directory path.

    2) you are using Unity 2018: it now tries to decide whether sln/csproj should be generated by looking at said external editor value, they are only generated if Unity recognized the editor.

    - Here is the subtle problem:

    a) Because of (1), the current workaround has been to create a fake app that redirect call to VSCode, so that Unity expose the custom command line field (aka External Script Editor Args):

    Screen Shot 2018-06-04 at 16.07.54.png

    b) Because of (a), Unity doesn't recognize my editor; and due to (2), it doesn't generate sln/csproj file.

    c) VSCode's C# plugin depends on omnisharp, which depends on these files to startup, hence breaking the integration.

    d) Current workaround is to switch back to VSCode integration, double-click a file in Unity so that it generates the sln/csproj files, then switch back to previous editor integration.

    e) Another drawback: Unity wouldn't refresh existing sln/csproj files if you are currently using an unrecognized editor. I am not 100% certain on this, but IF it's the case, then workaround (d) will eventually break and Omnisharp integration will break per (c), as csproj no longer contain latest files.

    f) I should also note that VSCode omnisharp has a smart rule where it will try to detect new files even though they are missing from csproj, so things might appear to work when you first add the file, but breaks on VSCode relaunch, fun time.

    - My suggestion for a fix:

    Please expose the command line field (External Script Editor Args) for any known editor as well, so we don't have to do the dance.


    (Added a feedback page in case people want to vote for it)
    Last edited: Jun 4, 2018
    LeonhardP likes this.
  2. miniwolf_unity


    Unity Technologies

    Apr 10, 2018
    Yes, this problem is very obvious and not just related to VS Code specifically. Thank you for highlighting this problem.
    I don't see a specific workaround for the sln/csproj generation problem that you mention.
    I am working on making a change so we can expose the variables, and change them for specific editors. This will mean that the public API will support packages asking for a regeneration of the sln and csproj files.
    bitinn likes this.