Changing the default script template in Unity

When you create a new script in Unity, it creates a script with few namespaces and the Start and the Update function. It might be very useful when you are getting started. But in most of the cases we end up deleting a few functions and namespaces from the template.

Wont it be good if we can change the template to our requirement?

We can do that by editing the file from which Unity takes the template.

This file is available inside the Unity installation folder. Find the location where you have installed Unity. Then navigate to Unity\Hub\Editor\2021.3.11f1\Editor\Data\Resources\ScriptTemplates.

Unity Black Friday Deals

The Path may vary a little based on the Unity editor version and if you have installed Unity.

Open the file called as “81-C# Script-NewBehaviourScript.cs” and edit the template. DO NOT TOUCH THE TEXT INSIDE #.

If you are not able to save the file and you get an error then save the file in desktop and then copy and replace the file in location with the one you saved in desktop.

Now if you create a script in Unity, it will be same as the template that you created.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.