- Home /
Change the default script template?
Is it possible to change the default template that unity uses to create a script? Thanks
Answer by Bunny83 · May 24, 2011 at 09:50 AM
Sure you can ;)
Just go into your Unity-installation-folder and navigate to "/Editor/Data/Resources/". There you will find all templates.
- NewBehaviourScript.cs
- NewBehaviourScript.js
- NewBehaviourScript.boo
- NewShader.shader
And even UnityObject.Source.js
and UnityObject.js
that are used in the webplayer's html page.
How do I find the installation folder? I'm using a $$anonymous$$ac. I tried looking through the package contents, I even did a search of my whole computer, and I couldn't find it.
On the $$anonymous$$ac they are in the Resources folder inside the app package. The full path is /Applications/Unity/Unity.app/Contents/Resources
, hit Command-Shift-G, paste this path and hit Open. This should get you into the folder (if you haven't renamed the Unity folder).
That's probably a permission issue. Either use a text editor that properly asks for ad$$anonymous$$ permissions when needed (e.g. Text$$anonymous$$ate does this) or try copying the file to the desktop, edit it there and then copy it back.
I had to log in as ad$$anonymous$$istator, rename the old one and name new one the correct name, there was no way to edit the current one directly.
Path slighlty changed over years. Windows 7, Unity 5.3.6f1: C:\Program Files\Unity\Editor\Data\Resources\ScriptTemplates\
Btw, see the answer to this question to define magic keywords
Answer by NateJC · Apr 22, 2012 at 09:37 PM
As of Unity 3.4, they are now located here (Mac):
/Applications/Unity/Unity.app/Contents/Resources/ScriptTemplates/
Answer by dylan16hl · Jan 22, 2015 at 05:12 AM
For Unity 4.3 on PC it is
C/E/F:/Program Files (x86)/Unity/Editor/Data/Resources/ScriptTemplates
Answer by zak-reynolds · Sep 23, 2015 at 07:10 PM
If anyone is using the new Linux editor and wondering where these templates are located, you can find them in the following directory:
/opt/Unity/Editor/Data/Resources/ScriptTemplates
You'll probably need to go root to modify them, but it works!
Answer by jura_wd · Nov 16, 2018 at 07:04 PM
1) Create Assets/ScriptTemplates to override built-in templates on a per-project basis. 2) Reopen the project
This actually works! Unity won't put the default files there, so you've got to copy the ones you want to override from the folders mentioned above.
Your answer
Follow this Question
Related Questions
default script editor now working anymore 0 Answers
Edit the c# script template 1 Answer
C# Script Template - how to make custom changes? 1 Answer
Change Default Script Folder 5 Answers