![debug in visual studio code unity debug in visual studio code unity](https://i.stack.imgur.com/0eY7b.gif)
Hook up an Android device, enable debugging and build an APKīefore you can use your Android device for development you need to follow the instructions here. In my case I was trying to debug some Android specific stuff so there were a few more things I had to do to get debugging code running on the Android to work.
![debug in visual studio code unity debug in visual studio code unity](https://visualstudio.microsoft.com/wp-content/uploads/2019/09/GetStarted.jpg)
Visual Studio is now debugging your game running in Unity!! Playing your scene from within Unity (using the play button at the top).Selecting the “Attach to Unity” debug button at the top of the window:.Opening Visual Studio from the Unity project (using Open C# Project).Once I selected that, I exited the preferences and when I tried “Open C# Project” again it came up in Visual Studio!Īt this point you should be able to debug your game by: Changing that from “Open by file extension” to “Visual Studio” made things work for me: In the dialog select “External tools” then at the top is an option for “External Script Editor”. I’m not sure why that is but it can be fixed by going to the “Edit” menu and selecting “Preferences …“. It looks like what’s going on is Unity isn’t generating the. Right clicking in the “Project” pane at the bottom shows an “Open C# Project” option that should open your project in Visual Studio but when I tried it, it opened an explorer window instead. The next step is done from within Unity so go ahead and open your project in Unity (or create a new one).
![debug in visual studio code unity debug in visual studio code unity](https://gigi.nullneuron.net/gigilabs/wp-content/uploads/2021/08/unity3d-vscode-downgrade-omnisharp-4.jpg)
Make sure you check the “Microsoft Visual Studio Community” dev tools module (although it says 2017 it worked fine for my VS Community 2019 install) as well as “Android Build Support” (and anything else you need): Now you’ll be presented with list of modules to choose to install. Select “Add” to add a new Unity version to your compute and select a specific version (an LTS version is always a good choice). You can find it here.Īfter you get Unity Hub installed, start it up, configure your license and then click on the “Installs” nav item on the left:
DEBUG IN VISUAL STUDIO CODE UNITY INSTALL
These days Unity Hub is the best way to install and manage different Unity. When installing Visual Studio be sure to select the “Game development with Unity” workload: You can find the Visual Studio Community Edition installer on this website. If you’ve already installed a Unity version though you can always go back and add the VS dev tools module after the fact. It’s easiest to have Visual Studio installed before before installing your Unity version so that when Unity installs it installs the VS dev tools. I recently set up Unity on a new laptop and things went fairly smoothly so I thought I’d document the process to try to help others out. The first time I tried writing a mobile game using Unity I found it took me way too long to get things set up where I could actually debug code running on the Android device. Using Visual Studio to debug a Unity game on Android device