How to update the default behavior script in Unity3D

Creating new C# scripts in Unity3D is a simple process with a click of a mouse; although I find myself updating the default behavior script to match my coding preferences each time I create a new script.

Here’s how I update the default script to simplify my development process.

Browse to the Unity3D installation folder (typically¬†named “C:\Program Files (x86)\Unity\”) and locate the sub-folder “Editor/Data/Resources/ScriptTemplates”

unity3d-template

Here you will see the template files used to create new scripts.  On my system I have five templates: javascript, C#, Boo, shader, and computer shader.  I am interested in the C# template.

Open the file named “81-C# Script-NewBehaviourScript.cs.txt”

unity3d-template-1

Update the layout file

unity3d-template-2

Save the file

Now, when I create a new C# script in Unity3D it uses my preferred coding style layout.

Note: if you re-install Unity3D then you will need to update the layout file again.