Skip to content

Commit dd4c56d

Browse files
committed
Update readme descriptions
1 parent 6848e76 commit dd4c56d

File tree

1 file changed

+60
-15
lines changed

1 file changed

+60
-15
lines changed

README.md

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,81 @@ From `Assets/Script Templates Editor` you can open the **Script Templates Editor
2929

3030
![Custom Script Template Editor](https://user-images.githubusercontent.com/9505905/193695307-3b607ab4-9c31-4dab-b96b-176ac57589c2.png)
3131

32-
Here you can set your Author Name and Email to add to your script's signature header. Also, you can choose to use the **local date format**: _9/13/2022 (en-US)_, for example, or the standard ISO format: _2022-09-13_. You need to click `Save` to store this data into
33-
the [Editor Prefs](https://docs.unity3d.com/ScriptReference/EditorPrefs.html). You also have the option to clear the saved data.
32+
Here you can preview in realtime what your script will look like, customize the values and copy the templates.
3433

35-
Immediately below that, we have a list of all included Script Templates and you can select them to locate the file.
36-
You also have two buttons: `Copy to Project` and `Copy to Editor`. The first one will copy all script templates to the current project `Assets/ScriptTemplates` path,
37-
limiting the script template usage to that project. The other will copy all script templates to your Editor folder, and you will be able to use the templates
38-
in all projects. However if you don't have this package in a project, it will not replace the `#AUTHOR#` and `#CREATIONDATE#` keywords on the file.
34+
### Settings
35+
36+
You can decide to enable both the Signature and the Namespace modules, each with their own set of custom settings.
37+
38+
#### Signature
39+
40+
The Signature module adds a simple signature header on your script following the template:
41+
42+
```cs
43+
/**
44+
* #SCRIPTNAME#.cs
45+
* Created by: #AUTHOR#
46+
* Created on: #CREATIONDATE#
47+
*/
48+
```
49+
50+
The `#SCRIPTNAME#` is no stranger to custom script templates, as it is replaced by the default Unity asset processor.
51+
However, both the `#AUTHOR#` and `#CREATIONDATE#` will be replaced by the values you set on the `Author`, `Email(optional)` and `Use Local Date` fields under the Namespace module group.
52+
53+
#### Namespace
54+
55+
The Namespace module adds a namespace to your file, indenting the template content under it.
56+
For that to work, you need to have a template such as:
57+
58+
```
59+
#NAMESPACE#public class #SCRIPTNAME# : MonoBehaviour
60+
{
61+
public void Start()
62+
{
63+
64+
}
65+
}
66+
```
67+
68+
Then, if enabled, the namespace will be replaced according to the values you set.
69+
If you enable `Use Assembly Definition`, make sure the script is in the correct location to be linked to an assembly definition, or the `Default Namespace` will be applied.
70+
Otherwise, if you decide to just use the `Default Namespace`, then it will be applied to all scripts.
71+
Additionally, you can choose whether the auto indent use spaces or tabs and their amounts.
72+
73+
Finally, you should `Save` your changes once you're satisfied with your settings, to make sure they will be used whenever creating a new script.
74+
You also have the option to `Clear` those settings at any time, if you wish.
75+
This data is saved to the [Editor Prefs](https://docs.unity3d.com/ScriptReference/EditorPrefs.html) cache.
76+
77+
### Templates
78+
79+
This section shows a list of all included Script Templates and you can select them to locate the file.
80+
You also have two buttons: `Copy to Project` and `Copy to Editor`.
81+
The first one will copy all script templates to the current project `Assets/ScriptTemplates` path, limiting the script template usage to that project.
82+
The other will copy all script templates to your Editor folder, and you will be able to use the templates
83+
in all projects.
84+
However if you don't have this package in a project, it will not replace the custom keywords on the file and might lead to compilation issues.
3985
Also, if you update the Unity Editor version, you will lose the script templates and require to copy them again. This is not necessary if you copy them to your project.
4086
Both actions of copying to project and to editor will require an editor restart to take effect.
4187

4288
How it works
4389
---
4490

45-
The custom Script Templates have the keywords `#AUTHOR#` and `#CREATIONDATE#` that will be replaced by the data you entered on the Editor
46-
Window and the present date. The keyword `#SCRIPTNAME#` is automatically replaced by Unity. All other keyword recognition and replacing is
47-
done by the [ScriptKeywordProcessor](Assets/CustomScriptTemplate/Editor/ScriptKeywordProcessor.cs) class.
91+
The custom Script Templates have custom keywords that will be replaced by the data you entered on the Editor Window and the present date.
92+
The keyword recognition and replacing is done by the [ScriptKeywordReplacer](Assets/CustomScriptTemplate/Editor/ScriptKeywordReplacer.cs) class.
4893

4994
Customization
5095
---
5196

52-
You can customize your Script Templates to suit your needs, for example adding default methods or even new keywords to process. Keep in
53-
mind that if you ever want a feature that it does not have, I may want to include it on this package.
97+
You can customize your Script Templates to suit your needs, for example adding default methods or even new keywords to process.
98+
Just make sure you add them to the correct folder and add the custom keywords following the same rules as the built-in templates.
99+
Keep in mind that if you ever want a feature that it does not have, I may want to include it on this package.
54100

55101
But, why?
56102
---
57103

58-
I like to have my scripts signed so everyone knows who to ask when they have doubts. Unfortunately with every new version of Unity,
59-
I have to redo the tedious process of updating my Script Templates manually. I'd very much like to be able to [manage my Script Templates
60-
over the Unity Hub](https://forum.unity.com/threads/feature-request-manage-script-templates.532962/), but looks like no one else
61-
uses it.
104+
It all started when I wanted to have my scripts signed so everyone knows who to ask when they have doubts.
105+
Unfortunately with every new version of Unity, I had to redo the tedious process of updating my Script Templates manually.
106+
I'd very much like to be able to [manage my Script Templates over the Unity Hub](https://forum.unity.com/threads/feature-request-manage-script-templates.532962/), but it's a very minor feature.
62107

63108
---
64109

0 commit comments

Comments
 (0)