Open ChrisTucker2000 opened 4 years ago
Will look into this soon, our VSCode integration is kind of messy in order for debugging to work so something might've broken.
On Mon, Jun 22, 2020 at 10:15 PM ChrisTucker2000 notifications@github.com wrote:
I'm trying to get Unity to work alongside VS Code, with both installed as Flatpaks. As far as I can tell, this Flatpak is supposed to have support for this, as there's a vscode.py file in the repository talking about launching the Flatpak and bridging together the sandboxes. Sounds great... but it isn't working for me.
I have a Unity project with vscode-editor set as the external code editor, with $(File) set as the args. This is how it was configured out of the box. The first time I tried to open a script from within Unity, it told me to install the .NET and Mono extensions. I installed them from GNOME Software, and running flatpak list -a confirms that I have org.freedesktop.Sdk.Extension.dotnet and org.freedesktop.Sdk.Extension.mono5 installed. (Note: I also have com.visualstudio.code.oss and com.visualstudio.code installed — I already had those in the first place.)
After installing the extensions, I tried again to open my script from within Unity... and nothing happens. I've tried restarting Unity, but it's still the same thing. Nothing happens. Looking at GNOME Logs, I can see the messages Started flatpak-com.visualstudio.code.oss-92753.scope. and flatpak-com.visualstudio.code.oss-92753.scope: Succeeded. appearing when I try to open the script, but nothing else shows up in the log and VS Code doesn't open. If I run Unity through the terminal, there's no error output or anything. If I open System Monitor, I can see that there's no VS Code process running in the background.
Nothing happens.
I've tried hacking around to find my own solution, but I can't get anything that I'm happy with. If I set flatpak-spawn as the editor, and set its arguments to --host flatpak run com.visualstudio.code.oss $(File), then I can open my files in VS Code through Unity. However, it only opens single files (no folder/solution), and every time I open a file it launches an entirely new instance of VS Code, which isn't ideal...
Any advice? Thanks.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/flathub/com.unity.UnityHub/issues/41, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM4YSMPAEEIGJILCY4ZURTRYAM3TANCNFSM4OFHUK3A .
-- Ryan (ライアン) Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else https://refi64.com/
Is there any progress on this? For me Unity just gives me a popup saying I need to install Visual Studio Code, even though I already have it installed as a Flatpak. Right now I just open Visual Studio Code manually and select the "Open Folder" option to then select the Unity project. It would however be much nicer if I could just double-click a script from within Unity itself...
What distro are you on? It works for me on Fedora 32. Both VS Code and Unity installed as flatpaks.
Alpine Linux, but I'm not sure why that would matter. I thought the whole point of Flatpak was to not have to care about the base system anymore.
Oof I had thought this had been fixed in one of https://github.com/flathub/com.unity.UnityHub/commit/a61ceafac3f3f4177ea7123bf8dc5e2d77cc2724 or https://github.com/flathub/com.unity.UnityHub/commit/fae935fd53c4d33b4de47712e906281ab31571d3, but I guess it wasn't... I can't reproduce it, but I'm also on Fedora as well, so I might have to spin up an Alpine VM at some point and see.
I thought the whole point of Flatpak was to not have to care about the base system anymore.
Technically yes, but for this Flatpak we do shell out to the base system to run the VSCode Flatpak to work around some hardcoded Unity stuff.
It does not work because it is trying to search the "dotnet" with runtime 21.08 which is not available now: https://github.com/flathub/org.freedesktop.Sdk.Extension.dotnet/issues/14
To overcome this I installed dotnet6//21.08 and edited the file installed in the system "/var/lib/flatpak/app/com.unity.UnityHub/x86_64/stable/e5bea653114a7a097b2be5320a667fabc1eb9ff0b49d120e61b318ec0d2f075c/files/bin/code" (vscode.py) as in the following:
It is working now. I think it is safe to switch to dotnet6 for now.
And for IntelliSense to work there is another issue we need to fix with the mono6 script: Mono6 enable script unlike dotnet6 enable script, is using a variable for some reason. This variable for good reasons is not set in the unity hub environment so it doesn't set the environments correctly; Quoting the current script "/usr/lib/sdk/mono6/use.sh" below:
export PATH=$PATH:${FLATPAK_DEST}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${FLATPAK_DEST}/lib
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}${FLATPAK_DEST}/lib/pkgconfig
export MONO_GAC_PREFIX=/app
To fix it we can set FLATPAK_DEST before calling it.
I am attaching the diff for my workaround for the file https://github.com/flathub/com.unity.UnityHub/blob/master/vscode.py below
--- /home/acakar/vscode.py
+++ /home/acakar/vscodefix.py
@@ -60,10 +60,10 @@
for (( i=$$; i < $target_pid; i++ )); do /usr/bin/true; done
/tmp/Unity infinity &
-
-[[ -d /usr/lib/sdk/dotnet ]] && . /usr/lib/sdk/dotnet/enable.sh
+[[ -d /usr/lib/sdk/dotnet6 ]] && . /usr/lib/sdk/dotnet6/enable.sh
+FLATPAK_DEST=/usr/lib/sdk/mono6
[[ -d /usr/lib/sdk/mono6 ]] && . /usr/lib/sdk/mono6/use.sh
-
+unset FLATPAK_DEST
# Note: don't do grep -q, code --list-extensions doesn't like SIGPIPE
if $code --list-extensions | grep ms-vscode.csharp >/dev/null &&
! grep -qs '"omnisharp\.useGlobalMono"\s*:\s*"never"' \
@@ -232,11 +232,11 @@
else:
ref_to_search = missing_sdk_extension_refs[0]
- await not_installed(ref=ref_to_search,
- title='dotnet and mono6 SDK extensions are required',
- text='The dotnet and mono6 SDK extensions are required for the Unity '
- 'debugger to work.',
- branch=sdk_arch_branch.split('/')[-1], available_on_web=False)
+ #await not_installed(ref=ref_to_search,
+ # title='dotnet and mono6 SDK extensions are required',
+ # text='The dotnet and mono6 SDK extensions are required for the Unity '
+ # 'debugger to work.',
+ # branch=sdk_arch_branch.split('/')[-1], available_on_web=False)
target_pid, transport = await forward_unity_socket(unity_port)
res = await flatpak('run', '--command=bash', ref, '-c', VSCODE_SCRIPT, '--', str(target_pid),
After all these, you need to be sure VSCode setting "omnisharp.useGlobalMono" is set to "always". After all these it is now working including intellisense,
@Yabgu please try #68 and see if it works for you
@refi64 it works. I just needed to install dotnet5 and mono6 for 21.08 target. We can call this is fixed with that PR,
Hi, just wanted to mention that this appears to be broken again.
After installing the latest version of UnityHub that checks for dotnet5 instead of dotnet there are a few issues now that present themselves.
First off, the error message was not updated to reflect the need for "dotnet5" instead of "dotnet" which made it very confusing when trying to t-shoot the problem as I already had dotnet installed and was still getting the error message.
Second, at least in my case, the script is looking for the 22.08 version of the sdk packages and not 21.08, which makes the whole thing not work with dotnet5 as that stops at 21.08. I've modified the alert message that the script generates to figure this out.
I'd recommend modifying the error message to the following so that it's more descriptive to the user:
await not_installed(ref=ref_to_search,
title='Missing SDK extensions are required',
text='The following SDK extensions are required for the Unity debugger to work \n\n'
f'org.freedesktop.Sdk.Extension.dotnet6/{sdk_arch_branch}\n'
f'org.freedesktop.Sdk.Extension.mono6/{sdk_arch_branch}\n',
branch=sdk_arch_branch.split('/')[-1], available_on_web=False)
So I've modified the file further to look for dotnet6 instead of dotnet5 and installed the appropriate dotnet6 packages. Now my final problem is that when I click a .cs file in Unity, even though the error message no longer shows up as all validation passes, VS Code does not start just like @ChrisTucker2000 reported initially. If I start VS Code manually and point it at the project folder everything works just fine.
Any advice would be greatly appreciated.
As you've highlighted @taranasus , things have moved on, and we are force to move to 22.08
branches, dotnet6
rather than 5, and on top of that the omnisharp vscode extension requires the full mono6 with msbuild
(something that is unfortunately missing in the flathub mono6 release!).
But luckily @priahoud has recently done the work to progress on these:
msbuild
: https://github.com/flathub/org.freedesktop.Sdk.Extension.mono6/pull/1322.08
update https://github.com/flathub/com.unity.UnityHub/pull/73I am facing a similar issue. I am using UnityHub and VSCodium (both from flatpak) on Fedora 39. I am quite a newbie with flatpaks overall so I followed a this guide installing both mono6 and dotnet6 versions 23.08 to get VSCodium to open my Unity3D projects without issues and intellisense working.
However, I am not able to open VSCodium through Unity3D. Since I had a similar issue when working with MacOS in the past, I created a bash/zsh alias "code" that just runs the flatpak version of codium and made sure it worked fine on my host system.
Unity3D still refused to open any files, nor the C# repository. I also tried creating a "fake" Visual Studio Code app that is just a script containing:
!/usr/bin/zsh
flatpak run com.vscodium.codium $@
And then I configured the Unity3D editor like so with no luck:
I feel like am so close to get it working together, but I am making a rookie mistake somewhere along the way. Does anyone know what am I doing wrong?
Hi there,
I'm Aurora, Justin's AI-powered Personal Assistant. I've noticed from your email that you're encountering issues with opening VSCodium from within Unity on Fedora 39 using flatpak.
It seems like you've done quite a bit of troubleshooting already, and your approach with the bash/zsh alias and the "fake" Visual Studio Code script were creative attempts to resolve it. However, there may be a few other things worth checking:
If you're still having trouble, I would recommend reaching out to the specific communities for UnityHub and VSCodium for more specialized support.
Remember, learning these tools and troubleshooting can take time, so be patient with the process, and I'm sure you'll get it to work. Keep experimenting and reaching out for help when needed.
Best regards, Aurora for Justin
P.S. If you find a solution that works, it would be great to share it on the GitHub issue for others who might face the same problem in the future.
From: Alberto @.> Sent: Sunday, December 3, 2023 1:39:50 AM To: flathub/com.unity.UnityHub @.> Cc: Taranasus @.>; Mention @.> Subject: Re: [flathub/com.unity.UnityHub] VS Code won't launch from within Unity (#41)
I am facing a similar issue. I am using UnityHub and VSCodium (both from flatpak) on Fedora 39. I am quite a newbie with flatpaks overall so I followed a this guidehttps://www.jwestman.net/2021/07/01/vscode-flatpak-csharp.html installing both mono6 and dotnet6 versions 23.08 to get VSCodium to open my Unity3D projects without issues and intellisense working.
However, I am not able to open VSCodium through Unity3D. Since I had a similar issue when working with MacOS in the past, I created a bash/zsh alias "code" that just runs the flatpak version of codium and made sure it worked fine on my host system.
Unity3D still refused to open any files, nor the C# repository. I also tried creating a "fake" Visual Studio Code app that is just a script containing:
!/usr/bin/zsh flatpak run com.vscodium.codium $@
And then I configured the Unity3D editor like so with no luck: Screenshot.from.2023-12-03.02-30-41.png (view on web)https://github.com/flathub/com.unity.UnityHub/assets/22345650/4ac4ecfd-19f0-4363-8e09-a8cb1ebe4363
I feel like am so close to get it working together, but I am making a rookie mistake somewhere along the way. Does anyone know what am I doing wrong?
— Reply to this email directly, view it on GitHubhttps://github.com/flathub/com.unity.UnityHub/issues/41#issuecomment-1837304211, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADEKVZHBA7GA7EX6SHDQ4BLYHPJ6NAVCNFSM4OFHUK3KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBTG4ZTANBSGEYQ. You are receiving this because you were mentioned.Message ID: @.***>
Hi,
How could I make sure UnityHub and VSCodium have the proper permissions set to interact with each other? I have flatseal installed, but I am not sure how to setup what is suggested in your response.
Thanks in advance
I'm trying to get Unity to work alongside VS Code, with both installed as Flatpaks. As far as I can tell, this Flatpak is supposed to have support for this, as there's a
vscode.py
file in the repository talking about launching the Flatpak and bridging together the sandboxes. Sounds great... but it isn't working for me.I have a Unity project with
vscode-editor
set as the external code editor, with$(File)
set as the args. This is how it was configured out of the box. The first time I tried to open a script from within Unity, it told me to install the .NET and Mono extensions. I installed them from GNOME Software, and runningflatpak list -a
confirms that I haveorg.freedesktop.Sdk.Extension.dotnet
andorg.freedesktop.Sdk.Extension.mono5
installed. (Note: I also havecom.visualstudio.code.oss
andcom.visualstudio.code
installed — I already had those in the first place.)After installing the extensions, I tried again to open my script from within Unity... and nothing happens. I've tried restarting Unity, but it's still the same thing. Nothing happens. Looking at GNOME Logs, I can see the messages
Started flatpak-com.visualstudio.code.oss-92753.scope.
andflatpak-com.visualstudio.code.oss-92753.scope: Succeeded.
appearing when I try to open the script, but nothing else shows up in the log and VS Code doesn't open. If I run Unity through the terminal, there's no error output or anything. If I open System Monitor, I can see that there's no VS Code process running in the background.Nothing happens.
I've tried hacking around to find my own solution, but I can't get anything that I'm happy with. If I set
flatpak-spawn
as the editor, and set its arguments to--host flatpak run com.visualstudio.code.oss $(File)
, then I can open my files in VS Code through Unity. However, it only opens single files (no folder/solution), and every time I open a file it launches an entirely new instance of VS Code, which isn't ideal...Any advice? Thanks.