JetBrains / resharper-unity

Unity support for both ReSharper and Rider
Apache License 2.0
1.21k stars 134 forks source link

Consider using Unity's ScriptTemplates instead of/as well as File Templates #1830

Open citizenmatt opened 4 years ago

citizenmatt commented 4 years ago

Unity's new script templates are stored in the product folder (e.g. C:\Program Files\Unity\Editor\Data\Resources\ScriptTemplates or /Applications/Unity/Editor/Data/Resources/ScriptTemplates). They should not be edited, as any upgrade will lose the changes. However, there is documentation from Unity detailing how to modify them.

However, it is also possible to create an Assets/ScriptTemplates folder in your project to contain customised templates. (The forum thread says "override templates", it should be tested to see if new templates are also picked up).

We should consider somehow making these templates available in ReSharper/Rider, as additional templates, or even replacements for existing File Templates. Perhaps as a sub menu in the Add menu? Can we "import" them as non-editable/hidden File Templates and use the existing code to create the file for us?

Also, it should be checked that if Assets/ScriptTemplates works, does {Package}/ScriptTemplates work? The Unity.Entities.Editor package includes a ScriptTemplates folder, but requires a script to make them work. We could treat this as a convention and expose those script templates through Rider.

citizenmatt commented 3 years ago

See also this tweet and thread.