Some more extensive script templates for C# development.
- Import Unity Package from Releases tab.
- Follow the editor window instructions.
- Done. Enjoy your new templates.
An empty class in Game namespace. Useful for objects that do not directly interact with the Unity libraries.
The standard MonoBehaviour subclass with a few added magical Unity event functions:
- Start(): Called right before the first Update() after #SCRIPTNAME# is enabled.
- Update(): Called every frame.
A subclass of the UnityEditor. Editor class that is used for making custom inspectors for classes.
A subclass of ScriptableObject. Useful for scripts that do not need to attach to specific GameObjects.
An empty interface in Game namespace. Useful for quickly creating a very simple interface file.
The format is:
{SortingIndex}-{MenuItemName}-{FileName}.txt
{SortingIndex} is some number used to order the items in the "Create New" context menu, duplicates are allowed.
{MenuItemName} is a string that defines the name of the item. It can be a nested item, use double underscores "__" to indicate going into a folder, sorta like with the [CreateAssetMenu] attribute, except in that one they use forward slash "/" instead. A bit confusing.
{FileName} is the default suggested filename that Unity has highlighted, when the user clicks the menu item to create the file. There seems to be some additional magic string searches going on for the filename. If the string "Test" appears in the filename (case insensitive), Unity will automatically create and move the new file to an Editor folder, in the current directory.
#SCRIPTNAME# - Unity asset preprocessor just replaces them with the script filename (without extention) so that’s a nice touch there too.
#NOTRIM# - To explain why they are there, in Unity 5.5, tabs were added to some empty lines in the templates for better indentation. The #NOTRIM# text is a special marker used by the template file system to mark lines that end in whitespace, like tabs. They prevent that whitespace from being stripped by our source code tools. The Unity Editor then strips all the markers when the template is used.

