t4
T4 text template generative importer for Unity3D. View On GitHub 📝🏗
T4 Text Templates provide a way to generate csharp code from templates, which are a mixture of text blocks and control logic. If you've ever used Mushtache or Go's html/template, T4 templates are pretty similar. This package allows Unity developers to author T4 templates (.tt
files), and rely on the Editor to process them and generate code.
Installing
This package supports openupm - you can install it using the following command:
openupm add com.faster-games.t4
Or by adding directly to your manifest.json
:
Note: You may also use specific versions by appending
#{version}
where version is a Release tag - e.g.#v1.2.0
.
dependencies: {
...
"com.faster-games.t4": "git+https://github.com/faster-games/t4.git"
}
Or by using Package Manager to "Add a package from Git URL", using the following url:
https://github.com/faster-games/t4.git
Documentation
Please also see these resources from Microsoft, as they are the authors and maintainers of the T4
templating featureset and format:
Quickstart
- Add a
.tt
file underAssets
- Select it in the Project window
- Note that the importer used is
TextTemplateImporter
- that's us! - Any processing errors will be shown in the Console
Supporting the project
If this project saved you some time, and you'd like to see it continue to be invested in, consider buying me a coffee. ☕ I do this full-time, and every little bit helps! 💙