JetBrains / JetBrains/resharper-unity
Consider using Unity's ScriptTemplates instead of/as well as File Templates
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 142
- PR merge metrics
- No merged PRs in 30d
Description
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](https://support.unity3d.com/hc/en-us/articles/210223733-How-to-customize-Unity-script-templates).
However, it is also possible to [create an `Assets/ScriptTemplates` folder in your project](https://forum.unity.com/threads/how-to-create-your-own-c-script-template.459977/#post-3898429) 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.
Contributor guide
Research direction
Start by reviewing Unity's ScriptTemplates documentation and the linked forum discussion, then investigate the Assets/ScriptTemplates and {Package}/ScriptTemplates conventions. Check how Unity.Entities.Editor uses its ScriptTemplates folder and how Rider's existing File Templates and Add menu could expose them. Done means a decided and implemented approach for discovering, importing, and presenting Unity script templates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- game-dev, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100