Unity: Best Plugins to Game Development in Visual Studio Code

Hello welcome to another video, I am also Lotosos, also known as Luís and today we’ll talk of its about plugins for Visual Studio Code, that you can use with Unity. First, before talking about plugins lets talk stuff about how to connect Visual Studio Code with Unity, you go to preferences and then you select external tools and then in the external script editor you click there, and you need to browser your Unity your Visual Studio Code *file* To found it you need to go to to search for Visual Studio Code and then you click it in execute the file and then you click right click in the file and you search for the file localization, then you can just select it and the the unity connection with Visual Studio Code will be completed. Then, you just need to go to a player for example and your object and you click in any script. You double click it and then it will open in Visual Studio Code everything you need. Like you can see in this example, There are several scripts like the movement and audio manager. To add extensions, you click in the extension tool and first you need to search for c#. C# gives several features like syntax highlighting, intelisense go to definition, find references and mono debugging. There are several tools that you can use to simplify and do faster and better code. Here in the details there are several things about the versions to use, how to install the extension, what you need to run to do several things and this is the basics. Then if you go to any code like movement dot C#, you can see that you can create several things with with this extension. So if you start with m_rigidbody2d, that is our object in our script and then you can choose any of these things, so you can choose GetComponents and then you can choose GetType for example and it gives all this information you can also go and it gives information about what goes inside a vector or a function so if we create a RaycastHit and then you go Physics2D.Raycast, it will show in the auto-completion what we need to put to complete the function. So here we can see it gives a vector origin and then it shows that you need to put a vector2 with a direction, so you can choose if you want to go up, down and you can go vector2.up for example and then we put a comma and it shows what is the next variable we need to input. It’s a float with a distance, we put the distance and then finally it shows that we need to put a “int” with a layer mask. Then the next plugin we need to use is Unity Code Snippets. This plugin gives us faster code, with several features that you can input in the script and it gives a faster code: like start, you can use update function, the OnTriggerEnter2d function and it autocompletes and does code really fast. We can create scriptable objects, we can create several things. In this file it show us all the game classes, the editor classes, the methods that you can use with this script. So let’s go and check it out, in the script we can go again to movement and if we create log, it creates automatically the Debug.log also we can go and create a function, we go up here and we do a start function. It automatically creates the start function with private void. We can go and create OnCollisionEnter, OnDestroy, on several things. For example, now we can do OnRender, OnDisable, OnEnable. We can also go OnCollisionEnter, like I showed and it gives us the “other” in the collision We can also create a new scripts like test.cs, and then with this script we can create MonoBehaviour and autocomplete or a scriptable object and this plugin autocompletes all the information that we need. So it gives us faster code and we don’t need to lose time on searching stuff like this if you don’t remember or you dont need to lose time writing this stuff. Next script is Unity Tools: Unity tools is a script that gives us direct connection between our code and the Unity website documentation, we need to use control and quote or you can use ctrl shift and quote, a single quote. This script when you use these commands you go directly to the Unity documentation website and it show us here how we can do that commands and how we can install, so if we go to our movement C# and then we click in ctrl shift P and search for documentation, you can see what commands do you need to do and in my case its control and ordinal indicator. So if I click in GetAxisRaw and do Control ordinal indicator, I just click accept and it will open the Unity website with several documentation pages, like in this case GetAxisRaw. You just need to clickt it and it will open all that documentation that exists. You can also go for example and do control shift ordinal indicator in my case and search for anything you want and in my case what I searched for was FixedUpdate and accepted it and you’ll open all the documentation that exists with FixedUpdate. The last extension that I think that’s really important is Debugger for Unity, that is an extension from Unity Technologies, the unity company, that they created and we can debug Unity. To do that we click in the debug option or you click Ctrl+Shift+T and you see there is no configuration, so you need to click in this box and click in unity. So it will create a launch.json with all the information and now you have several stuff you can choose between linux play or unity editor. And if you click the start debugging green box it will start debugging all the information. You see I already created a breakpoint in player movement and when the player enters with other objects, that the tag name is win, it will stop the code like you see there is a red dot over there. So if we start playing the game and we go to a gem you go to the left and if you enter with it, it will stop the code and in the exact line we told to stop. As you can see it will stop there and it won’t move until you click on start next line or jump next line or start debugging again, you’ll see there is several information that you can use like stack and variables that are working on that moment. You can see the score is “1”, the run speed, you can see static members, you can see the tag of the player, you can see where it is on the map. There are several stuff you can use and search for and then If you click on continue it will continue the game as you can see and you can start playing and go to another gem and it will do the same exact thing. So if you enter the gem the game will stop again and you’ll be in the code in the exact line you wanted, so you can jump line to line and see how the variable change. Before this score variable was in “1” and now we entered and score is “2”, as you can see, it changed the number to “2” and this is a really good example of how an extension can change our code debugging. So there are these are the 4 extensions I believe that are the best, the C# extension that gives us several Intelisense possibilities, the debugger to debug the code, the Unity Code Snippets that gives us faster code and provide us several information and finally Unity Tools that you can use to search documentation. Thank you so much for keep watching to this very moment, if you enjoyed the video give a thumbs up and subscribe to the channel for more content in game development. Join my discord server and follow my social media, where I post everything I do in this area. We will find every link down there in description. See you next time. Bye

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *