After you’ve developed in Unity for a while, you’ll be well aware that MonoBehaviour’s Start() will be used for initialization and Update() will be called once per frame. I found that I started erasing the two comment lines that point this out from new classes, so I looked for a way to change Unity’s C# template. This also proved handy for adding “using” statements for frequently used namespaces (System.Collections.Generic in my case).

On Mac, you can edit the default code templates by changing the files in /Applications/Unity/

(If you’re new to OS X, this means you right-click the Unity app in Finder and select “Show package contents” to get to the Contents folder.)

On Windows, the templates are supposedly in [Unity install path]/Unity/Editor/Data/Resources/ScriptTemplates/ – however I haven’t verified this as I don’t have a Windows machine with Unity on it. (If you’re a Windows user, please leave a comment and I’ll update this post.) – Update: Brent says this is indeed where the templates are.

This is for creating C#, JS and Shader files from inside the Unity editor, which I still find myself preferring to creating new files in MonoDevelop. If you’re looking for a way to change MonoDevelop’s own templates, this blog post should be helpful.


2 Responses to Unity quick tip: Change the template for new classes.

  1. Brent says:

    Ah, thanks for this! There’s usually a bunch of copyright notices and using statements I always have to add.
    I’m on windows, and it is indeed in that directory.
    Thanks again! ^_^

  2. Worked like a charm on OS X, thanks!

    Btw, click here to vote for a more robust template system in MonoDevelop:

Leave a Reply

Your email address will not be published. Required fields are marked *


9 × six =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>