Announcing the Unity extension for Visual Studio Code
Today we are thrilled to announce a preview of the Unity extension for Visual Studio Code.
Remember when we launched the first preview of C# Dev Kit this past June? It delivers an editor-centric approach that elevates your C# development in Visual Studio Code with great features including a native Test Explorer, a dedicated Solution Explorer, and the incorporation of AI in code authoring, to name just a few.
Today, we’re delighted to present the initial preview of the Unity extension for Visual Studio Code. This new extension, building upon the C# Dev Kit and C# extensions, gives you a comprehensive toolkit for your Unity development in Visual Studio Code across Windows, macOS, and Linux.
We invite you to test drive the Unity extension for Visual Studio Code today and we’re eager to hear your thoughts!
With this extension, Visual Studio Code becomes a great companion application to Unity where you can write and debug your Unity games. C# Dev Kit and the Unity extension borrow some familiar features from Visual Studio and Visual Studio Tools for Unity to enhance your productivity, making your Unity development delightful with C# in Visual Studio Code, regardless of the platform you target; desktop, mobile, or consoles, and everything in between.
What is the Unity extension?
Code Editing powered by Roslyn
C# editing is backed by the newly updated open-source C# Extension, giving you powerful IntelliSense code-completion. Along with the IntelliCode for C# Dev Kit extension, you get AI-assisted features such as whole-line completions and starred suggestions as you type.
The extension also includes the Unity Roslyn Analyzers project, giving you custom suggestions and code fixes tailored to Unity.
Debug Unity and your Unity games
The extension makes it easy to debug your Unity games, either running in the Unity Editor or standalone, while running on all the platforms that Unity support. Just press F5 to attach the debugger to your game running in the Unity Editor or use the new “Attach Unity Debugger” command to see a list of Unity Editors and Unity Players that you can debug.
After that, just put a breakpoint in your code and run your game in Unity!
Getting Started with the Unity extension
First, you’ll need at least Unity 2021. Then just install the Unity extension for Visual Studio Code. Visual Studio Code will automatically install all the extensions the Unity extension depends on, including C# Dev Kit and C# extensions. When that’s done, you need to switch to Unity to continue.
The Unity extension for Visual Studio Code depends on the Visual Studio Editor Unity Package. In Unity’s Package Manager (Window menu then Package Manager), please make sure the Visual Studio Editor package is upgraded to `2.0.20` or above.
Note: the `Visual Studio Code Editor` package is a legacy package that is not maintained anymore. The Visual Studio Editor package now handles the entire family of Visual Studio products.
When your Visual Studio Editor package is up to date, go to Unity’s preferences and simply set Visual Studio Code as Unity’s External C# editor.
The next time you open a C# file in Unity, Unity will open Visual Studio Code for you.
C# Dev Kit and the Unity extension for Visual Studio Code are built on the same foundations as Visual Studio, they are licensed under similar terms as Visual Studio is. This means they are free for individuals, academia, and open-source development, just like the terms that apply to Visual Studio Community. For organizations, C# Dev Kit and its family of extensions are included with Visual Studio Professional and Enterprise subscriptions, as well as GitHub Codespaces. For additional details, please refer to the license terms.
For developers who prefer using a fully featured IDE, we continue to recommend using Visual Studio with the Visual Studio Tools for Unity which together deliver a feature rich development experience tailored to Unity.
What’s Next? Share your Feedback!
This is a preview, and we will update the extension and its features based on your feedback so we can deliver a great experience for all Unity developers.
Please share your suggestions and report issues on this new experience through Visual Studio Code’s Help > Report Issue dialog. Select whether it’s a bug, feature request, or performance issue, then select “An extension” and “Unity” in the following dropdowns.
More about the Visual Studio product family
Visual Studio continues to be our premier C# development tool, supporting the full range of .NET workloads and project types. C# Dev Kit and the Unity extensions represent new capabilities that extend .NET development productivity to other parts of the Visual Studio product family. For more information on the latest features added to Visual Studio, check out the Visual Studio 17.6 release announcement.