Create a Custom Template

Creating your own custom templates is super easy! Just create a .txt file and enter the code you want it to contain. Unity will then replace every occurrence of #SCRIPTNAME# with the name you enter when creating the script.

Here is an example of normal C# class with a constructor:

public class #SCRIPTNAME# 
{
    public #SCRIPTNAME#()
    {
    
    }
}

Want more examples? Check out the default templates coming with Script Templates!

Once you have created your template text file, you need to add it to your templates directory. Check out the next chapter to see how to do it!

Last updated