Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

VS code - files not opened from Unity

Discussion in 'Import Formats & External Tools' started by Fr2, May 30, 2019.

  1. Lightning_A

    Lightning_A

    Joined:
    Nov 30, 2018
    Posts:
    7
    ...
    I had this problem for one of my projects on Windows 10. I tried restarting my computer and it didn't work. Then I restarted and installed a quick update for my computer and it's working now. Weird.
     
  2. xsyww

    xsyww

    Joined:
    Dec 14, 2016
    Posts:
    1
    My solution to this problem is below and my environment is: win10 + u3d 2019.2.12f1.
    1. open your unity editor and double click on one .cs file ( and of cource, vsCode didn't start and show code),
    2. open your Windows TaskManager and force kill all Visual Studio Code processes, maybe some warning messages would appear and ignore it.Make sure all vscode process was killed.
    3. try double click .cs file in unity editor, and it works in my pc.

    I don't need repeat these operation, restart unity editor is still no problem with vsCode.
     
  3. BeginnerPolymath

    BeginnerPolymath

    Joined:
    Jul 31, 2015
    Posts:
    26
    If you try open .cs file but he didnt open, you can try open VSCode and click any Recent project, maybe is help you upload_2019-11-28_23-22-2.png
     

    Attached Files:

  4. Inc4nuS

    Inc4nuS

    Joined:
    Apr 13, 2016
    Posts:
    2
    I've installed the plugin and didn't work. So what I did was see the Processes from windows and to my surprise, there were a few of Visual Studio Code. Finished them all, closed unity and voilá. It worked.
     
  5. frixou89

    frixou89

    Joined:
    Oct 28, 2019
    Posts:
    1
    This worked for me right away after I tried everything else
     
  6. Brilath

    Brilath

    Joined:
    Jan 5, 2018
    Posts:
    1
    So my VS code was working until I started my new project and I believe it is due to me having spaces in my directory path. Hope this simple fix works for you all.

    Unity Version: 2019.2.11f1

    G:\UnityFun\Classic Clashing (Didn't work)
    G:\UnityFun\Classic-Clashing (Worked)
     
  7. RChrispy

    RChrispy

    Joined:
    Dec 18, 2013
    Posts:
    59
    I do not use any plugin.

    As I saw that several people have this proplem I wanted to share a simple solution that worked for me.



    Just paste this into your External Script Editor Args after choosing Visual Studio Code:
    Code (JavaScript):
    1. . -n -g $(File):$(Line)
    For people who want to know what this actually does:

    . - takes the current directory as unity uses the project folder to open its internal cmd(or powershell I am not sure) it will point to your project folder perfect
    -n - will always create a new window normally but this will not happen if it is a folder! by default vscode uses -r but it has a problem with unitys terminal session so the -n fixes this issue :)
    -g - is a goto to open a file at specific line if line is not provided it will just open at start of file.

    Sidenote:
    Seems I only face this problem on mz windows10 machine it works fine on my mac without changing the parameters.
     
  8. RChrispy

    RChrispy

    Joined:
    Dec 18, 2013
    Posts:
    59
    ps: just saw you can also use:
    Code (JavaScript):
    1. "$(ProjectPath)" -g "$(File)":$(Line):$(Column)
     
    Personuo likes this.
  9. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    39
    “ $(ProjectPath)” -g“ $(File)”:$(Line):$(Column)
    Ťhis is useful to me
     
    RChrispy likes this.
unityunity