Fixing issues with VS Code and Unity on Pop!OS Linux...again

UPDATE - The better fix:
Okay…last night, in preparation for this momentous occasion, I did a complete re-install of Pop!OS on my Oryx Pro.

When I went to install VS Code from the POP!Shop, there were two versions available. One for Flatpak, and one for Pop!OS. I chose the Pop!OS version.

When I clicked on the script in Unity, it would ask if I wanted to install VS Code from Flathub, as if Unity did not see the version that was already installed. Naturally, I avoided that option.

I tried deleting the Pop!OS version via the Pop! Shop uninstall route but I could not get it removed easily.

I took the advice from Unity and went to the Flathub.org site (not the Pop! Shop) and I followed the ‘Linux specific’ instructions there to install VS Code.

There were a couple of Terminal commands to use, but they were copy/paste so I’m not repeating them here.

After that was done, the Unity/VS Code relationship seems back to normal again.

Final thoughts: Don’t use the Pop!OS version of VS code, even if you are running Pop!OS. Use the Flatpack version and you probably won’t have this issue.

This also causes the project folder to open in VS Code, as it should. The original solution below does not.

I’m leaving the original post below for those people who are interested in exploring Terminal and the file system so they can see the details. I moved the fix to the top so people won’t waste their time doing the wrong thing.

****** The original post *****

I’m posting this for the benefit of the other four or so Linux users in here.

Okay, so I took a break for a while. I decided to come back and do the Obstacle Course game again.

I immediately ran into the issue of “Unity cannot find VS Code on your computer”…however it’s worded, and I had to stop the lessons to troubleshoot.

I’m using Pop!OS, a Linux distro. This fix might also work for other Debian based distros such as Ubuntu, but it might need a little more tweaking.

Anyway, a quick Google search told me that in the Pop!OS file system, VS Code is stored in:
/usr/bin/code

I selected “Open by file extension” and set the External Script Editor Args to:
$(usr/bin/code)

Then I could open my scripts by clicking on them.

More information:

If you open Terminal and type in:
cd /usr/bin

…and from that prompt type:
ls -l

…you’ll find a big list of stuff, and among it you’ll see this:

This tells us that the /usr/bin/code actually redirects to a different location of:
/usr/share/code/bin/code

If we follow that path to /usr/share/code/bin/code we will find:
Screenshot from 2023-08-11 20-41-48

This is technically the more accurate location, as shown here:

Both will arrive at the same result:

If you don’t have your folder open yet, you’ll need to open the folder, but if you already have the folder open in VS Code, then any new script will be added to the project and you can click to open the script.

Anyway, I hope this helps someone.

UPDATE:
This resets after closing Unity. Even if I save the project, it resets back to the default and I need to do this process again.

Still working on a better fix.

Privacy & Terms