This page looks best with JavaScript enabled

Customize Unity Editor Generated Scripts - Quick Tip

 ·   ·  ☕ 1 min read

You can modify the default scripts Unity generates for you when you use create new MonoBehaviors from inside the editor, generate new Tests or Shaders. If you’d like to modify the default template that Unity provides you with you can navigate to the directory where Unity stores the files and modify them to fit your needs. This will cause all new files of that type generated by Unity to follow the new template.

The ScriptTemplates directory is located with your Unity installed files. For example for Unity 2019.1.0f2 the directory will be at 2019.1.0f2\Editor\Data\Resources\ScriptTemplates. Templates are unique per Unity version so make sure you’re modifying the correct version of Unity.

To keep your script templates up to date it may help to store them in source control of some kind, otherwise you’ll need to manually ensure they are updated with each update to the Editor.

Here is a Unity support article about customizing your script templates: https://support.unity3d.com/hc/en-us/articles/210223733-How-to-customize-Unity-script-templates

The comments in this post go a bit deeper into the #NOTRIM# lines. They are not needed anymore and existed to prevent some formatting by the Unity editor. https://support.unity3d.com/hc/en-us/articles/210223733/comments/115000611483

Join the World of Zero Discord Server: https://discord.gg/hU5Kq2u


Sam Wronski
WRITTEN BY
Sam Wronski
Maker of things and professional software engineer. Lets make something awesome together!