HI!
I’m very new to Linux, I ran into the same issue and have been going in circles for a while trying to resolve this.
Here’s what I’ve found so far.
Bear in mind that this info is limited to my current understanding of how Linux distributions work.
At first I tried the Flatpak approach which delved me into a rabbit hole of errors and unmet dependencies that I didn’t understand or have the capacity to deal with.
As far as I understand Flatpacks are unofficial versions of programs which run in a sort of “shell” which emulates the way the program or app might run on Windows, similar to what Wine does with games, again I might be wrong here, but I can tell you for sure that the VS CODE app from flathub is not the official version, it even gives you a text editor warning when you open the program.
Unity doesn’t require mono6 and .Net SDK’s to run, those are for VS Code, it needs them to run scripts, debug, and I don’t really know what else, but I’m guessing much more.
So far, I’ve found that if I install VS Code from Snap (snapcraft.io), along with the .Net SDK from the same source + the mono libraries from the official site (mono-project.com) then VS code will run without issues after a reboot. (You have to reboot in order for the icon to show up in app launcher.)
Furthermore, in VS code on the left side, you should find the extension page which will take you to a list of possible extensions you can install for it, one of them is the C# extension, be sure to install that as well.
Now if you execute a C# script inside the Unity Editor it will prompt you to select Visual Studio Code from a list of IDE’s.
In Unity Hub, for the version of the Editor you are using, make sure you have Windows Build Support(mono) installed.
When you open the Unity Editor, under Edit, preferences, external tools, External Script Editor, select, open by file extension.
That’s it, now if you run a script inside the editor it will run in VS code without issues.
I did all of this on Pop! OS , best wishes and I hope this helps.