So I tried to change my Script template today.....

FUTURE READERS: Read Second post if you want to know the easy way to do this.

First it took me 10 minutes to figure out how to change “administrator permission” on my Windows 10 machine for this ONE little text file, so I could save it.

This little text file is called “81-C# Script-NewBehaviorScript.cs.txt”

I changed it to this:

using UnityEngine;

public class #SCRIPTNAME# : MonoBehaviour
{
   [TextArea(0,0)]
   public string empty_Script;
}

A little relaxed now, it was worth reading all those articles about how to change administrator permission on a file, constantly trying things, saving, being told I don’t have permission etc, (this was the trick for, future frustrated Unity devs using Windows10 https://thegeekpage.com/how-to-fix-you-dont-have-permission-to-open-this-file-error-in-windows-10/)

a) Right-click on the file which you’re unable to access and select Properties.

b) Click on ‘Security’ tab and under ‘Group or user names’ click on ‘Edit’.

c) Click on ‘Add’ and type ‘everyone’.

d) Click on ‘Check names’ and then click ‘OK’.

e) Select ‘everyone’ and under ‘Allow’ select ‘Full control’ and click on ‘Apply’ and Click ‘Ok’.

Anyways, create test script… still using annoying old template that takes an extra 5 seconds to clear out with every start, for no reason.

Alright I think, need to refresh visual studio, and I’ll restart Unity too…

Restart them…
…Nope. new script still has the old stupid commented Update and Start template.

Guess it’s time to delete my library file, and rebuild? No Thanks.

Oh, and I bet the next time I install a new Unity version, I get to do all this all over again, or I can just be annoyed by deleting the worthless noob drivel (that has never helped a single Unity or scripting noob) they fill the starting template with, on every, single, new… script… I create…

You can actually do this in your project folder itself now (which I didn’t realize until I googled just now, so thanks for prompting me to learn this!). Not sure when they added this feature but you can:

  1. Create Assets/ScriptTemplates/TemplateName.cs.txt
  2. Put your template in there, with the #SCRIPTNAME# placeholder
  3. Restart Unity

And boom, there it is!

By the way, if you’re going to go to the trouble of making your own script template, please put your class in your own namespace… it’s a good habit to be in.

3 Likes

Silly me, trying to use the official unity support page:

https://support.unity.com/hc/en-us/articles/210223733-How-to-customize-Unity-script-templates

2 Likes

Actually there are two official Unity support pages, here is the other one.

https://support.unity.com/hc/en-us/articles/4403342550548-How-to-customize-Unity-script-templates-on-Unity-Project

Cool, but in my defense, that was created four months after I posted the link I was using. (it was created (Aug 3, 2021))

freaking seriously lol, this is such a better way

1 Like