About using Visual Studio Code in Unity under OS X

    Hello, Habr!

    As much as I would not like this, there will be no intrigue in today's article. Of course, it would be possible to build ornate verbal constructions, play with synonyms and delay the moment of truth, but no - this article is about using Visual Studio Code in Unity under OS X. More precisely, this article will focus on the initial configuration of Unity and binding VSCode editor for your project using the dotBunny plugin.

    Use this as a quick guide for beginners, a guide, or whatever it is called. In addition, if you have long wanted to try VSCode, but could not come up with a suitable script, then I composed everything for you - just follow the steps.



    Caution, under the cut some screenshots.

    In order to start development on Unity under OS X, you need the following things (here you can start to bend your fingers):
    1) A computer running OS X. Potentially, any of the latest versions will work.
    2) Unity 5. Lives here - unity3d.com/en/get-unity/download . There is nothing complicated in the installation, after downloading the installer, simply agree with all the points proposed.
    3) If you are a complete beginner, then read the series of articles about creating a platformer - you can start reading from here

    4) The next step is to download Visual Studio Code - code.visualstudio.com. Code is a cross-platform editor, which appeared as a result of the following conclusion: Visual Studio on OS X and Linux porting is long and expensive, but having a high-quality lightweight editor that has all the features of the Studio editor is very good and convenient. Soon the editor will become open source (http://habrahabr.ru/company/microsoft/blog/271199/), and you will have to be content with the installer. However, the installation of VSCode, as in the case of Unity, does not cause much trouble and is fast enough. As a result, you get a full-fledged C # editor that can do IntelliSence, code highlighting and other nice things that he got from his “elder sister” - the studio.



    5) Next we need a plugin, without which nothing will work - github.com/dotBunny/VSCode. It is he who allows you to make Code the default editor in Unity and properly configure debugging mechanisms, IntelliSence, and everything else. The debugger for Unity, by the way, so far only works in OS X, so you and I are very lucky. If you are not using git, then you can use the quick link to download the archive with the plugin.

    After loading the plugin, transfer the “Plugins \ Editor \ dotBunny” folder to the Assets folder of your project. If you don’t have the Plugins folder yet, create it. Right now.

    On this, the fingers of the first hand are over, so shift the second hand to the touchpad. Or use some kind of Jedi scrolling.

    6) Find the VSCode tab in the Preferences window in Unity. In some cases (for example, if you work in Unity under Windows), searching for this item in the menu may take some time - it is located in the “Unity” menu.



    All that remains to be done to connect is to quickly hit the left kidney of the mouse on the “Enable Integration” checkbox. Here it is:



    Now the item “Open C # project in Code” has appeared in the Assets menu. This, as the name implies, allows you to open VSCode in the context of your project - and if you do not close the editor in the process, double-clicking on scripts in Unity will also open the desired script in the context of the project.

    7) An open project is as follows:



    In the left part of the window is the structure of your project, all editable files. In the right part, in fact, is the code editor, in which autocompletion, highlighting and all the other things that are sweet to the heart from adult editors and development environments work. You can read more about what and how in Code at the link .

    Fortunately, you can stop bending your fingers, because at this point, Code finally communicates with Unity and we can work in the most comfortable and friendly environment. But, just in case, the last point.

    8) Design a game. Make a chic project that will conquer the whole world and bring you infinite glory. As you can see, the easiest point I left for dessert.

    This is where the fairy tale ends. As usual, ask your questions in the comments and share your experience with VSCode with us.

    Useful links:


    Also popular now: