- Home /
How do I change the default monoDev C# file?
I've actually been through this once before. Back in 3.5 I had edited the default C# template file within unity to remove the comments describing the Start and Update methods. I get really tired of erasing those every single time I make a new script. However I noticed that anytime I updated unity it would overwrite the file. I also noticed that file does not appear to be the temple file that monodev itself is calling. So my question is how the hell do I change this?
I can't believe that the lions share of the entire unity development community erases those 2 lines every time they open a new file?
I went ahead and made a script to Replace the default script template
Just edit the .txt file to your liking and run the shell script in there to replace the file. Needs to run under cygwin to work in windows (if someone wants to write a batch script that could be neat too I suppose).
Answer by doug__ · Dec 03, 2012 at 09:47 AM
It's annoying isn't it.
Sadly that template seems to be embedded into the UnityUtilities.dll, which makes it annoying to change.
There is a solution, but its a pain to do.
If you go into options Preferences -> External Tools -> Script Editor and use a normal (non-bundled) version of mono develop you can write a custom Addin (see http://monodevelop.com/Developers/Articles/Creating_a_Simple_Add-in). This lets you add extra template options in the 'new file' dialog, and customise them however you like.
Better yet, if you upgrade, you can just install the addin again on your new copy of monodevelop.
Writing addins is quite a laborious process though. If you can be bothered, its worth it...
So I would need a non unity bundled version of monodev in order to build that add on but I would then install in inside unities bundled version of monodev? Ugh this is starting to sound like way more trouble then manually deleting 2 lines in a new file....
Oh well. I'm hesitant to mark this response as "correct" but I think it's the right answer, The truth is I just don't like it.
Actually, you can write add-ins with the bundled version as well. Just start it by itself.
The process isn't that laborious... The documentation is hardly existent, and you can't debug add-ins well, but following the tutorial and poking around a bit, you should be able to have something going within a couple of hours.
All seems to be a lot of work to just continually remove 2 comments.... /sigh oh well.
Answer by foxor · Aug 07, 2013 at 04:50 PM
In unity 4, the template files are located in:
C:\Program Files (x86)\Unity\Editor\Data\Resources\ScriptTemplates
Assuming the default install directory.
In Unity 4 & 5 on OS X you go to the Unity app in Finder and browse the package with the Show Package Contents
on right-click. Then the path of the script templates is: Contents/Resources/ScriptTemplates
.
I've ended up making a shortcut to that folder to change the defaults quickly whenever there's an overwriting update.
Answer by humaldo · Apr 03, 2014 at 06:49 AM
Thx for the tipp, I just changed the default C# MonoDev template. BUT be careful, there's a trap (at least on Win 7): Changing/Saving the file in the C:-Program Files (x86)-Unity-Editor-Data-Resources-ScriptTemplates isn't allowed so I made a copy of the 81-C# Script-NewBehaviourScript.cs.txt file (for backup) directly in the folder (and this was the problem), then copied the original file somewhere outside, changed the content, and copied it back.
But from then on, something went wrong. I wasn't able to create new C# scripts anymore. I tried a few things, but the only solution was to reinstall Unity again. Afterwards I tried it again, and this time it worked. This is what I did:
Copied 81-C# Script-NewBehaviourScript.cs.txt to some other location on my harddrive
Copied it again for backup reasons
Changed the content of the file
Copied it back to C:-Program Files (x86)-Unity-Editor-Data-Resources-ScriptTemplates and overwrote the original file
Works fine!
Hope this was helpful :-)
Cheers, Christian
Answer by v01pe_ · Mar 16, 2016 at 01:44 PM
On OSX the folder where the default scripts are copied from can be found here (within your Unity folder)
Unity.app/Contents/Resources/ScriptTemplates
Edit the contents of 81-C# Script-NewBehaviourScript.cs.txt
for C# scripts and also others (the names speak for themselves).
If you don't know how to get inside the .app - Right (secondary) click on the .app and select Show Package Contents
Your answer
![](https://koobas.hobune.stream/wayback/20220613084855im_/https://answers.unity.com/themes/thub/images/avi.jpg)