Skip to content

Commit eae8f5e

Browse files
committed
Update README.md
1 parent c167d70 commit eae8f5e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Simple Code Generator
22

3+
[![openupm](https://img.shields.io/npm/v/com.sandrofigo.simplecodegenerator?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.sandrofigo.simplecodegenerator/)
34
[![tests](https://github.com/sandrofigo/Simple-Code-Generator-Unity3D/actions/workflows/tests.yml/badge.svg)](https://github.com/sandrofigo/Simple-Code-Generator-Unity3D/actions/workflows/tests.yml)
45

56
A library for generating source code from templates in Unity
@@ -17,7 +18,9 @@ A library for generating source code from templates in Unity
1718

1819
## Usage
1920

20-
Create a `public static void` method in a class anywhere in your Unity project and decorate it with the `[CodeGenerationMethod]` attribute. This will make the method visible to the code generator. If you want to expose the method to the "Code Generation" menu add a `[MenuItem(...)]` attribute.
21+
Create a `public static void` method in a class anywhere in your Unity project and decorate it with the `[CodeGenerationMethod]` attribute. This will make the method visible to the code generator.
22+
23+
If you want to expose the method to the "Code Generation" menu add a `[MenuItem(...)]` attribute.
2124

2225
```csharp
2326
public static class MyClass
@@ -42,8 +45,7 @@ public static class MyClass
4245
}
4346
```
4447

45-
Additionally you need a template file in your project which the code generator can use.
46-
Value names are case sensitive e.g. if you want to insert the value of the `data.Text` property in the data object you can do this by surrounding it with `{{ }}`. Accessing nested properties is the same as in C# e.g. `Animal.Color`.
48+
Additionally you need a template file e.g. `MyTemplate.txt` in your project which the code generator can use.
4749

4850
```
4951
// This is a sample template
@@ -62,7 +64,9 @@ public class My{{ color }}Class
6264
{{ end }}
6365
```
6466

65-
The generated file `MyTemplate.generated.cs` will look like this:
67+
Value names are case sensitive e.g. if you want to insert the value of the `data.Text` property from the data object you can do this by surrounding it with `{{ }}`. Accessing nested properties is the same as in C# e.g. `Animal.Color`.
68+
69+
The generated file `MyTemplate.generated.cs` from this example will look like this:
6670

6771
```csharp
6872
// This is a sample template

0 commit comments

Comments
 (0)