Reputation: 21
Visual Studio Code with Unity I have installed VS code and Unity on a MacBook Air with M1. My unity version is: Unity 2021.3.4.f1 Silicon LTS. I have set external tools in unity to work with visual studio.
Things I have installed: homebrew and wget, .net core, Mono stable channel, Mono visual studio channel, SDK dependencies, In visual studio: C# extension, Unity code snippets - Kleber Silva, Unity snippets - Ycleptic Studios
I tried to set OmniSharp Global mono to always but I couldn’t find it in VS code settings so I added "omnisharp.useGlobalMono": "always" to my settings.json. And I have restarted my computer a dozen times.
I have tried to check all Generate .csproj files in unity
My Visual studio does not autocomplete code for unity and when I compile a console.write(“hello world") it runs only on my terminal but it doesn’t launch in the VS code.
Upvotes: 0
Views: 1169
Reputation: 21
I managed and here is the solution. First I will post the errors I had so people having the same issues can find them more easily. If some step is not here you can also dm me bcs I had a big amount of errors.
Also link Unity to VS code if you haven't done so. It is in the comment above.
Install homebrew if after installation it does not work in terminal, run export PATH=/opt/homebrew/bin/:${PATH} now it should work. However, whenever I close the terminal I need to do this command again.
Install mono sdk either through mono-project.com (both channels for MacOS) or through homebrew
Export mono to path: PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:${PATH}
Install dotnet sdk https://dotnet.microsoft.com/en-us/download - arm64 if you have M1 chip. Otherwise x64 for intel versions. Export dotnet to PATH if dotnet --help shows you errors (even though 'dotnet' command itself may work)
In visual studio code install these extensions: C#, Unity code snippets - Kleber Silva, Unity snippets - Ycleptic Studios. Click on settings of C# extension (not VS code settings but settings of the actual c# extension), type 'useModernNet' and uncheck the box 'omnisharp.useModernNet'
I may have missed some steps but I will update them in less than a month because I will be reinstalling everything in my personal Mac.
**Also follow the steps here: https://code.visualstudio.com/docs/other/unity **You can see all the export PATH locations in this folder /etc/paths.d - here should be mono-commands, dotnet and maybe more stuff **If you need settings.json from VS code, it is located here: Library/Application\ Support/Code/User/settings.json
Upvotes: 1