Fully configuring Unity using flatpak?

Hi,

I’m trying to install Unity and set all the needed tools including VS Code with intellisense, but Im struggling ith mono and msbuild. Please excuse my bad english, as it’s not my mother’s tongue.

I have managed to install unity hub easily, VS Code, and dotnet and mono sdk extensions. This is what I have done:

To install Unity Hub

flatpak install flathub com.unity.UnityHub

This will allow to install easily releases.

To install VS Code

flatpak install flathub com.visualstudio.code

But we need dotnet and mono which are not included. You can also install flatpak versions, but you’ll have a lot of options… First, the runtime. Yo have to make sure that VS Code runtime matches the one of the extensions. And VS Code, now, uses 22.08 runtime. So when you install dotnet and mono6 you’ll be asked to choose one runtime, so choose wisely as if you dont use the same runtime version, it is not supposed to work with VS Code.

Then, when choosing dotnet version, new problems. We have dotnet (.NET 3.1) and runtime 19.08, so no usable. We have dotnet5 and runtime 21.08, so, again, not usable. We have dotnet6 with runtime 22.08, so we can use this one. But, what does unity have to say in order to have compatibility? Unity will search for a VS Code with dotnet5. So we’ll have to take a look here in the future. We even have a dotnet7 but didnt use it.

To install dotnet6 (remember to select runtime 22.08)

flatpak install org.freedesktop.Sdk.Extension.dotnet6

Mono is “easier” to install as it has only one option, mono6, but it will be a problem later.

To install mono6 (remember to select runtime 22.08)

flatpak install org.freedesktop.Sdk.Extension.mono6

Sonow we have a working Unity Hub, we can install releases easily, and open our files using VS Code. But there are some issues:

  1. Unity will complain that we dont have dotnet5 and mono6 in VS Code. But we just cannot fix this as he is searching for 21.08 runtime sdk extensions, but we have installed 22.08.

  2. VS Code will claim that he cannot find either dotnet nor mono. Here we can still at least, fix the dotnet part.

We have to set a environment variable when we open VS Code. That is easy to fix using terminal as we just have to add FLATPAK_ENABLE_SDK_EXT=dotnet6,mono6 at the start of the command. But as unity calls VS Code, we have to do something else.

To solve this problem, we will use FLATSEAL (we can install it with flatpak: flatpak install flatseal). Flatseal allows us to manage easily flatpak apps permissions. So we will open Flatseal, choose Code, and go down to environment, and add FLATPAK_ENABLE_SDK_EXT=dotnet6,mono6 there, in ENVIRONMENT, VARIABLES, as a new line.

So next time VS Code is open, he will not complain abput dotnet. Because in order to use mono6 we still need msbuild files which are not bundled in the flatpak. So I’m trying to figure this out.

Unity is usable, VS Code is usable, but not perfect. We have no intellisense, but I think that, hopefully, will be solved with mono6.

Where am I now?

  1. I want to fix adding mono6 with MSBuild. I’ve read a post where they manually add all needed files, but haven’t tried that yet.

  2. Make Unity stop complaining about VS Code not having mono6 nor dotnet5. This is minor, but still annoying.

  3. Make intellisense work.

So if anyone can help me, i would really appreciate it. :slight_smile:

Thanks in advance

PS I have tried to use flatpak unity with rider, and dotnet and mono are easily recogniced by rider. But dont know how to make Unity use rider yet. Still I would like to solve the free option so anyone can use it.

2 Likes

Lucky I found this as I was browsing to remake my tutorial for installing Unity on the Steam Deck.

The problem is, the latest stable version of unityhub flatpak is no longer compatible with VS Code flatpak as VS Code flatpak now uses runtime 22.08.

They are working on updating the flatpak so that it requires dotnet6 and mono6 with runtime versions 22.08. I hope I’m alowed to post links on here Update runtime to 22.08 by FakeShemp · Pull Request #73 · flathub/com.unity.UnityHub · GitHub

If you want to try it out, you can use the link in there further down to install and test the new flatpak build. I’m sure eventually everything will be fixed and functional again in the main branch but because this breaks every few months it’s quite frustrating.

Thx, in steam OS will work, if no autocomplet visual studio code, install .net extension from visual studio code

A huge THANK YOU for writing this nice tutorial with flatpak !!
I’ll try the few steps that I missed when I tried last month, and see what is possible from there :slight_smile:

"flatpak install org.freedesktop.Sdk.Extension.dotnet6 (22.08) org.freedesktop.Sdk.Extension.mono6 (22.08)

We have to set a environment variable when we open VS Code. That is easy to fix using terminal as we just have to add FLATPAK_ENABLE_SDK_EXT=dotnet6,mono6 at the start of the command. But as unity calls VS Code, we have to do something else.

To solve this problem, we will use FLATSEAL (we can install it with flatpak: flatpak install flatseal). Flatseal allows us to manage easily flatpak apps permissions. So we will open Flatseal, choose Code, and go down to environment, and add FLATPAK_ENABLE_SDK_EXT=dotnet6,mono6 there, in ENVIRONMENT, VARIABLES, as a new line."

This fixed my problem with unity and vscode giving me a weird dotnet and mono not installed popups. thank you for your help!