Home

Awesome

Unity Code Snippets

Create Unity classes and methods easily.

Visual Studio Marketplace Installs Visual Studio Marketplace Rating (Stars) Visual Studio Marketplace Version

Features

2.0.0: Support to style configuration. Now you can use K&R and Allman (C#/Unity default) styles! More at Configuration section.

All the Unity code snippets you need. This extension intends to be the complete collection of Unity snippets for Visual Studio Code.

It takes advantage of latest Visual Studio Code snippets features to create the code faster for you.

MonoBehaviour

Create game classes like MonoBehaviours, NetworkBehaviours and StateMachineBehaviours easily. Also create common methods like Start(), Update() or OnTriggerEnter2D() and log calls.

MonoBehaviour

Editor

Create Editor classes like Editor, EditorWindow and PropertyDrawer as easy as it can be.

Unity Editor

ScriptableObject

You never remember the property that goes with the ScriptableObject to create it via Unity create menu? Not a problem.

ScriptableObject

Installation

As in any Visual Studio Code Extension you have several options to install:

Configuration

Starting at version 2.0.0 the extension is configurable.

To configure the extension, open VSCode Settings and search for "Unity Code Snippets". Note that after changing any of the settings, you need to restart VSCode to apply them to the snippets.

Style

The indentation style for the snippets. For now you can choose between K&R (the default for 1.x version) and Allman (default to C#/Unity). If you need a different one, please leave an issue or upvote an existing one at the project issues bord. Default: K&R.

K&R style

K&R Indentation style

Allman style

Allman Indentation style

Use Private Keyword

Adds the private accessor keyword to private members. Default: true.

No private keyword

No private keyword

Auto Complete: Classes

Auto complete classes like MonoBehaviour and Editor.

Auto Complete: Methods

Auto complete methods like Start and OnCollisionEnter.

Auto Complete: Calls

Auto complete utility calls like Debug.Log and Debug.DrawLine.

Auto Complete: Attributes

Auto complete attributes like [SerializeField] and [RequireComponent] (just these two for now).

Auto Complete: Experimental Attributes

Auto complete all other attributes like [HideInInspector] and [ContextMenu]. There are a lot o attributes and this can pollute your Intellisense popup.

All the snippets

Start typing the names to create the corresponding snippet. Some of them have a special snippet to not mess up with the default Intellisense behavior.

Snippets are devided in categories, all of them can be enabled/disabled in the options.

If you have any suggestion, please don't give the extension a bad review. Instead, open an issue in the Github project page and I'll try to add it when/if possible.

If you like the color theme of the previews, you can download it here: Base16 Ocean Dark Extended Theme.

Thank you for downloading this extension.

If you like the extension, please rate it with 5⭐. And, if you are feeling especially kind today, also leave a kind comment: Review this Extension.