GameDevWare.TextTransform 1.0.10

Text to Text Transformation Templates (T4) transfomation library for Unity.

Install-Package GameDevWare.TextTransform -Version 1.0.10
dotnet add package GameDevWare.TextTransform --version 1.0.10
paket add GameDevWare.TextTransform --version 1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Introduction

This Unity editor extension provides T4 text templates processor.
T4 template is a mixture of text blocks and control logic that can generate a text file. The control logic is written as fragments of program code in C#.
The generated file can be text of any kind, such as resource file, source code or web page.

T4 template example:

<html><body>
 The date and time now is: <#= DateTime.Now #>
</body></html>

Use cases

How to use

Create or copy file with .tt extension. Select this file in Project window (Window -> Project), then in Inspector window (Window -> Inspector) setup T4 template's parameters. Click "Generate" button.
Inspector window for T4 template contains following parameters:

  • Output Type - type of generated file
    • Content - normal template's output. It corresponds to "Design-time T4 text templates" in Microsoft's terminology.
    • Generator - generator-class which can generate content when TransformText() is called. It corresponds to "Run time T4 text templates" in Microsoft's terminology.
  • Output Path - path to generated file. If not specified, generated file will have file name of template and file extension from output directive.
  • Auto-Gen Triggers - list of events which trigger auto-generation.
    • Code Compilation - after each code compilation
    • Asset Changes - after watched assets are changed, look for Assets to Watch
  • Auto-Gen Delay (Ms) - delay before triggered auto-generation starts
  • Assets to Watch - list of assets and folders which trigger auto-generation

Details

T4 template can use hostspecific=true property to access Host.ResolvePath method, which maps path relatively to template's location.

By default UnityEngine.dll and UnityEditor.dll assemblies are referenced in all templates.
You can reference project's assemblies Assembly-CSharp and Assembly-CSharp-firstpass by adding assembly directive:

<#@ assembly name="Assembly-CSharp" #>
<#@ assembly name="Assembly-CSharp-firstpass" #>

MSBuild Macros are not available.

You can run template generation from your code with UnityTemplateGenerator.RunForTemplate(templatePath) call.

Version 1.0.7

fixed missing 's' in project name 'TextTran_S_form', files, namespaces, folders has been renamed.
executable name of tools has been changed to 'GameDevWare.TextTransform.exe' new NuGet package will be published

Contacts

Please send any questions at support@gamedevware.com

License

If you embed this package, you MUST provide a link and warning about embedded package in the description of your package.

Asset Store Terms of Service and EULA

Introduction

This Unity editor extension provides T4 text templates processor.
T4 template is a mixture of text blocks and control logic that can generate a text file. The control logic is written as fragments of program code in C#.
The generated file can be text of any kind, such as resource file, source code or web page.

T4 template example:

<html><body>
 The date and time now is: <#= DateTime.Now #>
</body></html>

Use cases

How to use

Create or copy file with .tt extension. Select this file in Project window (Window -> Project), then in Inspector window (Window -> Inspector) setup T4 template's parameters. Click "Generate" button.
Inspector window for T4 template contains following parameters:

  • Output Type - type of generated file
    • Content - normal template's output. It corresponds to "Design-time T4 text templates" in Microsoft's terminology.
    • Generator - generator-class which can generate content when TransformText() is called. It corresponds to "Run time T4 text templates" in Microsoft's terminology.
  • Output Path - path to generated file. If not specified, generated file will have file name of template and file extension from output directive.
  • Auto-Gen Triggers - list of events which trigger auto-generation.
    • Code Compilation - after each code compilation
    • Asset Changes - after watched assets are changed, look for Assets to Watch
  • Auto-Gen Delay (Ms) - delay before triggered auto-generation starts
  • Assets to Watch - list of assets and folders which trigger auto-generation

Details

T4 template can use hostspecific=true property to access Host.ResolvePath method, which maps path relatively to template's location.

By default UnityEngine.dll and UnityEditor.dll assemblies are referenced in all templates.
You can reference project's assemblies Assembly-CSharp and Assembly-CSharp-firstpass by adding assembly directive:

<#@ assembly name="Assembly-CSharp" #>
<#@ assembly name="Assembly-CSharp-firstpass" #>

MSBuild Macros are not available.

You can run template generation from your code with UnityTemplateGenerator.RunForTemplate(templatePath) call.

Version 1.0.7

fixed missing 's' in project name 'TextTran_S_form', files, namespaces, folders has been renamed.
executable name of tools has been changed to 'GameDevWare.TextTransform.exe' new NuGet package will be published

Contacts

Please send any questions at support@gamedevware.com

License

If you embed this package, you MUST provide a link and warning about embedded package in the description of your package.

Asset Store Terms of Service and EULA

Release Notes

# 1.0.10
added library target
removed support for Unity 3.4 and lower
moved all code to Gamedewware.TextTransform namespace
added auto-detection of generated assets by Unity
added compilation check before running transformations
added additional information for generation failure cases
fixed generation 'failure' if generated code is as last one generated code

  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.

Version History

Version Downloads Last updated
1.0.10 0 4/20/2019
1.0.7 2,758 11/13/2017