How to Setup Visual Studio Code for Unity Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Visual Studio is great I've used it for ten years now I use it every day I've had nothing but great experiences using it but when it comes to unity there are some drawbacks when you're installing the editor through unity hub you get the option to add visual studio as well it is a Microsoft product so Mac and Linux users are out of luck when it comes to using Visual Studio without doing some extra work but on top of that just from a performance standpoint there's a lot of overhead that comes with Visual Studio that's not really needed for scripting and unity introducing Visual Studio code which works on Windows Mac and Linux so on top of streamlining my environment for all of my viewers to be on the same page in environment we're getting the additional bonus of having less tools and libraries loaded up every time we're opening our scripting editor Visual Studio code is not an integrated developer environment or an IDE it's just a text editor there are a lot of neat extensions though that you can download and incorporate into Visual Studio code to make it work just like Visual Studio does but in a much more lightweight form so since I'm on Windows I'm gonna go ahead and start the download for vyas code I'll use the default path that designates we have es code installed here with all the default settings so I haven't installed this or set it up yet I'm gonna be doing it for the first time in this video and I'm gonna be following this official guide that Microsoft provides it looks like first things first we need to make sure our dead net core SDK is up-to-date and installed so I'm just gonna go ahead to this like I'll lick everything in the description by the way I'm on a Windows machine but they also have Linux as well and so I'll download the SDK like it says great installation complete so our windows only it wants me to log back out and log back in or restart so I'm gonna do that really quick all right I just started and I'm back so it says we need to install the c-sharp extension from the vs code marketplace so be scared I'm gonna go to extensions and here's the c-sharp extension that's just installed cool alright that's finished so in unity instead of Visual Studio being our default editor when we open up the script we need to set it to Visual Studio code if you open up your file explorer you'll notice that there's this arrow in the top right and if you expand and go to the View tab make sure you have hidden items checked you'll see why in a second if we go to edit preferences external tools and then external script editor if you install Visual Studio code in its default location you'll need to go to browse and then go into your C Drive users your username app data which is a hidden file so that's why we had to check that local programs Microsoft Visual Studio code and then Cody XE so if you set that it'll take a second and then it will recognize its Visual Studio code and we'll close it so now when we try and open a script in unity there we go if you get to this point make sure that your intellisense is working because I know that's a common issue for a lot of people so make sure if you type out game object it shows up and you can finish it or like rigidbody2d and all of those other unity specific variables and class names if you're not getting intellisense to work then it's probably because you need to download this dotnet framework targeting pic or if you're on Mac this net SDK so just take a look through this document that's in the description if you're having any issues this probably has some troubleshooting in here if you go into the settings that Jason you'll see this exclusion file if I'm understanding right you used to have to set this up yourself but it looks like in more modern versions of unity and Visual Studio code it already handles support for this and it generates this settings file automatically which is awesome that helps a ton because that saves a lot of the setup for us something of acting from Visual Studio code that's in Visual Studio though is a debugger so I'm gonna go back to this extensions tab and they have this debugger for unity extension so I'm going to install this and see if I can get it going so I'm gonna try clicking this Run tab and since I don't have a debugger setup I'm gonna create a launch jason file with unity debugger which we just installed the extension for and it looks like it generated this launch file for us I think it should work so if I attach this test script to the main camera in the test script itself I'll just have these debug statements to start and update and I'll put breakpoints on them on the two different log statements I stopped running by the way so I'm going to rerun this okay cool so it looks like it's running now which means if I go into unity and hit play the main camera has the script attached it should hit the breakpoint on start and it does and then if I continue it should that hit update and it does and it should hit update every single time because it will hit it every single frame so this is awesome our debugger is working as expected cool I think that's essentially what you'll need to get started in using Visual Studio code they do have a bunch of other plugins let me know in the comments if you use Visual Studio code and there's any other packages I missed that you would consider are pretty important to have I know there's like unity tools and things like that but this is a good baseline and I don't want to over complicate this video but there is one more step you definitely need to do if you go to file preferences color theme you have a few different options oh god light beam is terrible if you go to vs code themes calm you can find a bunch of custom themes people set up and I gotta get the same one I had before oh yeah yeah vomit color theme that's that's the theme for me it actually is that's what I used to use except it was called something else so I'm gonna open this in Visual Studio code and install and it asked me to select a color theme so I'll pick and from behind vomit and we're back I'll be using this one so you just did all that hard work to set it up treat yourself a little bit pick out a nice theme set it up you're gonna be staring at this thing a lot you know you got to be happy with what you're looking at and with that I think this videos wrapped if this helped you out please give it a like I got all the links in the descriptions below so check that out I know this type of tutorial is not what I usually do but I'm gonna be using Visual Studio code from now on in my videos so I figured it would be beneficial in the long run just to show off my setup quick if people want to use exactly what I'm using so there you go the whole process from start to finish I have a bunch of other tutorials I've been working on and they should be coming out soon so subscribe if you want to tune in for more and thanks for watching [Music]
Info
Channel: BMo
Views: 233,175
Rating: undefined out of 5
Keywords: bmo, bmo unity, unity, visual studio, visual studio code, vs code, vs, code, IDE, c#, unity2d, unity3d, setup vs code for unity, using vs code with unity, tutorial, unity tutorial, learn, setup, install, configure, extensions, debugger, vs code unity debugger, game dev, game development, video games, environment
Id: MawL2dQIZ7s
Channel Id: undefined
Length: 6min 9sec (369 seconds)
Published: Sun May 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.