UnityTemplates Visual Studio Extension

Posted by redwyre on July 16, 2023

I have been working on a DOTS-first project for a couple of months (more on that later), and found myself wanting templates to help with creating the same types of files repeatedly. I created some local templates, and then a few months later Rider announced their new Unity tooling, so I decided to email the team that works on "Visual Studio Tools for Unity" however they didn't have any current plans for updates so I decided to package up what I've done any maybe replicate some of the functionality that Rider has.

I have release the project as open source, which can be found on github: https://github.com/redwyre/UnityTemplates Also, the template can be found here: https://marketplace.visualstudio.com/items?itemName=redwyre.UnityTemplates or by searching redwyre.UnityTemplates in the extension manager.

To access the templates, add a new file to your project, and look under the Unity subfolder on the left

The currently available template are:

General:

  • MonoBehaviour
  • ScriptableObject

DOTS/ECS:

  • Aspect
  • Authoring Component
  • IBufferElementData
  • ICleanupComponentData
  • IComponentData (unmanaged and managed)
  • IEnableableComponent
  • ISharedComponentData
  • ISystem
  • SystemBase

I did have a template that created a component+system+authoring however I'm not sure it's really that useful so I've left it out for now.

I have started looking at how to create code refactorings but it is incredibly complex so I might leave that for now, or until I can find some good tutorials on writing them.