It may not be all that important, but I think that the Create C# Script menu option is too limited, sometimes I at least wish that I could create scripts of a specific type (ie. Interfaces, enums, editor scripts etc.) directly from the editor as opposed to setting up the base framework of the script after creating it. I’ve personally created a fairly large number (15) of script templates, for everything I could reasonably think of. I’ll include the files themselves, to both show what I came up with but also to allow people to add their own opinion on what should or shouldn’t be a part of the suggestion. I’ve also included a script template for creating HLSL files. This would rename/replace the script template for the default C# Script menu option.
They should just make creating script templates less of a pain in the ass honestly. Also maybe clean up the context menu a little because that shit is ten miles long.
I might be misunderstanding, but you can do that already if you mess around with the ScriptTemplates folder:
I renamed the NewBehaviorScript to 81-C# Script__Default Template Script-NewBehaviourScript.cs and my two custom ones are 203-C# Script__Custom Templates Enum-MyCustomEnumTemplate.cs and 204-C# Script__Custom Templates Interface-MyCustomInterfaceTemplate.cs
Source: here (further comments explain the naming structure)
These do get nuked every time you update though if I remember correctly, or rather, they need to be copied to the new editor version’s script templates and if you don’t nest them you’ll only make the clutter mentioned by @Murgilod even worse.
using UnityEngine;
#ROOTNAMESPACEBEGIN#
public class #SCRIPTNAME# : MonoBehaviour
{
// Start is called before the first frame update
private void Awake()
{
#NOTRIM#
}
}
#ROOTNAMESPACEEND#
Anyone, feel free to use this as your base if you want to expand your template capabilities if you find it useful.
Obviously you can move the _baseTemplatePath anywhere you like. I do this way because eventually this moves into a package of mine, so the “dynamic”, editable template files have to remain in Assets/ space as opposed the functions which will be in packages (not modifiable) space.
Obviously the CTRL-ALT-O and CTRL-ALT-N shortcuts are redefinable in the Shortcuts window.
That is true, and I’ve done that, what I was suggesting was for Unity to include more script creation options, meaning that the C# Script option in the Create Asset Menu would no longer be a “button” for lack of a better term, but a collection of various options of C# Scripts that could be created. The files I included were copied from the ScriptTemplates folder of my Unity Installation.
A fine idea. I don’t think I’d use templates, but can see the benefits.
Perhaps you should check out the product roadmap of Unity Editor. If you want something to be added, which isn’t currently there you should be able to submit a new idea.
There are multiple alternatives to the built-in template creator on the Asset Store, most of which are free. UT even had one of their own (‘Create Script Dialog’) at one point, with source.