nvim-unity icon indicating copy to clipboard operation
nvim-unity copied to clipboard

c# Script not opening.

Open ShroomySquid opened this issue 1 year ago • 4 comments

I'm having trouble making nvim-unity work. It run but when I start the project it throw this error:

[NvimUnity] Failed to add the project to the sln file: ApplicationName='dotnet', CommandLine='sln /Users/fbarrette/Desktop/Unity Tutorials/Kitchen Chaos/Kitchen Chaos Tutorial/Kitchen Chaos Tutorial.sln add /Users/fbarrette/Desktop/Unity Tutorials/Kitchen Chaos/Kitchen Chaos Tutorial/Assembly-CSharp.csproj', CurrentDirectory='', Native error= Cannot find the specified file UnityEngine.Debug:LogError (object) NvimUnity.Project:GenerateSolution () (at ./Library/PackageCache/com.apyra.nvim-unity@22aa4a977bbe/Editor/Project.cs:101) NvimUnity.Project:GenerateAll () (at ./Library/PackageCache/com.apyra.nvim-unity@22aa4a977bbe/Editor/Project.cs:56) NvimUnity.NeovimEditor:SyncAll () (at ./Library/PackageCache/com.apyra.nvim-unity@22aa4a977bbe/Editor/NeovimEditor.cs:154) UnityEditor.CodeEditorProjectSync:SyncEditorProject () (at /Users/bokken/build/output/unity/unity/Editor/Mono/CodeEditor/CodeEditorProjectSync.cs:21)

It also throw this message: [NvimUnity] Succesfully generated csproj and sln files UnityEngine.Debug:Log (object) NvimUnity.Project:GenerateAll () (at ./Library/PackageCache/com.apyra.nvim-unity@22aa4a977bbe/Editor/Project.cs:57) NvimUnity.NeovimEditor:SyncAll () (at ./Library/PackageCache/com.apyra.nvim-unity@22aa4a977bbe/Editor/NeovimEditor.cs:154) UnityEditor.CodeEditorProjectSync:SyncEditorProject () (at /Users/bokken/build/output/unity/unity/Editor/Mono/CodeEditor/CodeEditorProjectSync.cs:21)

When I try to open a c# script it doesn't open it, and throw this message: [NvimUnity] Socket file does not exist: /Users/fbarrette/.cache/nvimunity.sock UnityEngine.Debug:Log (object) NvimUnity.SocketChecker:IsSocketActive (string) (at ./Library/PackageCache/com.apyra.nvim-unity@22aa4a977bbe/Editor/SocketChecker.cs:30) NvimUnity.NeovimEditor:OpenProject (string,int,int) (at ./Library/PackageCache/com.apyra.nvim-unity@22aa4a977bbe/Editor/NeovimEditor.cs:53) Unity.CodeEditor.CodeEditor:OnOpenAsset (int,int,int) (at /Users/bokken/build/output/unity/unity/Editor/Mono/CodeEditor/CodeEditor.cs:94) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:219)

It then proceed to try several terminals.

Any clue what's wrong and how to make it work? Is it normal to regenerate the .snl file everytime I load the project?

I'm on a MacOS Sonoma 14.4 using Unity version 6000.0.55f1, nvim is working fine otherwise and is up to date.

Thanks in advance.

ShroomySquid avatar Sep 17 '25 22:09 ShroomySquid

Thats strange, for instace you can set the flag addprojecttosolution to false in the Project.cs it May work anyway, maybe is a problem with your dotnet instalation. I did not tested on macos.

apyra avatar Sep 17 '25 22:09 apyra

It fixed the error message, but nvim still doesn't open the script. I think it has a hard time to find a terminal. Is there any way I can add Iterms to the possible terminals to open a script with?

ShroomySquid avatar Sep 17 '25 22:09 ShroomySquid

https://github.com/apyra/nvim-unity-standalone is open, if you can give a try any PR would be great.Also, I think this issue may be related to #2

apyra avatar Sep 17 '25 23:09 apyra

Can you try launching nvimunity script and show the logs. Also @apyra as you are on Windows environment. the sh files will have a caveat due to CR & CRLF issues.

I have writting a blog post about this Unity plugin along with a .nix file for NixOS to set this entire thing up easily.

https://blog.saladin.pro/unity-neovim-setup-ft-nix#heading-launching-nvim-with-the-socket-listener

Here is the part where I describe the issue and the fix.

And this is the blog itself -> https://blog.saladin.pro/unity-neovim-setup-ft-nix

Thanks for this plugin tho !

Saladin1812 avatar Oct 22 '25 16:10 Saladin1812