<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Willy Kuster Chimienti</title>
    <description>The latest articles on DEV Community by Willy Kuster Chimienti (@willykc).</description>
    <link>https://dev.to/willykc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F998438%2Ffe82cb71-464d-4294-bfd4-21e64f61dae0.png</url>
      <title>DEV Community: Willy Kuster Chimienti</title>
      <link>https://dev.to/willykc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/willykc"/>
    <language>en</language>
    <item>
      <title>Declarative code generation in Unity</title>
      <dc:creator>Willy Kuster Chimienti</dc:creator>
      <pubDate>Tue, 31 Jan 2023 08:21:36 +0000</pubDate>
      <link>https://dev.to/willykc/declarative-code-generation-in-unity-89a</link>
      <guid>https://dev.to/willykc/declarative-code-generation-in-unity-89a</guid>
      <description>&lt;p&gt;Code generation in Unity is often done imperatively with &lt;a href="https://learn.microsoft.com/en-us/dotnet/api/system.text.stringbuilder" rel="noopener noreferrer"&gt;StringBuilder&lt;/a&gt; or &lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview" rel="noopener noreferrer"&gt;Roslyn source generators&lt;/a&gt;. Text templates offer a declarative alternative to code generation, but setting them up in a Unity project is not straightforward.&lt;/p&gt;

&lt;p&gt;Interestingly, the Unity Editor makes use of templates for creating new scripts. They can even be &lt;a href="https://support.unity.com/hc/en-us/articles/210223733-How-to-customize-Unity-script-templates" rel="noopener noreferrer"&gt;customized&lt;/a&gt;, although their functionality is limited.&lt;/p&gt;

&lt;p&gt;What if text templates were just another asset in the Unity Editor? And could be used to generate code or any text asset. This is what I set out to accomplish with &lt;a href="https://github.com/willykc/templ" rel="noopener noreferrer"&gt;Templ&lt;/a&gt;. An open-source Unity Editor extension which integrates &lt;a href="https://github.com/scriban/scriban" rel="noopener noreferrer"&gt;Scriban&lt;/a&gt; templates to enable declarative text assets generation effortlessly.&lt;/p&gt;

&lt;p&gt;There are two prominent use cases for asset generation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;On-demand, where one or more assets are generated only once, whenever needed. Also known as &lt;a href="https://en.m.wikipedia.org/wiki/Scaffold_(programming)" rel="noopener noreferrer"&gt;scaffolding&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reactive, where an asset is generated in response to another asset changing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After installing Templ, &lt;em&gt;Scaffolds&lt;/em&gt; can be created to support the on-demand generation of assets and folders.&lt;/p&gt;

&lt;p&gt;To support reactive generation, &lt;em&gt;live entries&lt;/em&gt; can be configured to establish a one-way data binding between any existing text asset and a new text asset to be generated and automatically kept up-to-date. Both techniques will be described in more detail further below.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to install
&lt;/h2&gt;

&lt;p&gt;There are two ways to install Templ on a Unity project, via OpenUPM or as a git package. Keep in mind that the lowest supported Unity version is 2020.3.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install via OpenUPM
&lt;/h3&gt;

&lt;p&gt;The best way to install Templ is via OpenUPM. First, install OpenUPM CLI by following &lt;a href="https://openupm.com/docs/getting-started.html#installing-openupm-cli" rel="noopener noreferrer"&gt;these steps&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once OpenUPM CLI is installed on your system, open the terminal of your choice and browse to your Unity project's root directory. Then, type the following command and press &lt;strong&gt;Enter&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openupm add com.willykc.templ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwt5xuzp2xq2ts9yfmksm.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwt5xuzp2xq2ts9yfmksm.gif" alt="Installation" width="941" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Install as a Git package
&lt;/h3&gt;

&lt;p&gt;Alternatively, it can also be installed as a &lt;a href="https://docs.unity3d.com/Manual/upm-git.html" rel="noopener noreferrer"&gt;Git package&lt;/a&gt;. First, add the following scoped registry via &lt;strong&gt;Edit -&amp;gt; Project Settings... -&amp;gt; Package Manager&lt;/strong&gt; to satisfy the dependencies:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;URL&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;openupm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://package.openupm.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;org.nuget&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5r0j1sxraiztufc0tc8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5r0j1sxraiztufc0tc8.png" alt="Scoped registries" width="671" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Afterwards, select &lt;strong&gt;Window -&amp;gt; Package Manager -&amp;gt; Add package from git URL...&lt;/strong&gt;, enter &lt;code&gt;https://github.com/willykc/templ.git&lt;/code&gt;, and click on &lt;strong&gt;Add&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6koumbe97fnabeidl0ox.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6koumbe97fnabeidl0ox.gif" alt="Install as git package" width="1007" height="616"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  First-time setup
&lt;/h2&gt;

&lt;p&gt;Once installed, a prompt will appear in the Unity Editor. Click on &lt;strong&gt;Proceed&lt;/strong&gt; to create the &lt;strong&gt;TemplSettings&lt;/strong&gt; asset. By default, it can be found at &lt;em&gt;Assets/Editor/TemplData&lt;/em&gt; but can be moved anywhere in the project hierarchy. It can always be found by clicking on &lt;strong&gt;Window -&amp;gt; Templ -&amp;gt; Settings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftix9l0elkyp352ii9rlj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftix9l0elkyp352ii9rlj.png" alt="Settings inspector" width="472" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;TemplSettings&lt;/strong&gt; asset inspector has two sections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Live Entries, where input assets and templates are configured to generate output assets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Selectable Scaffolds, where scaffolds are configured to be selectable in the context menu.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to create a simple scaffold
&lt;/h2&gt;

&lt;p&gt;Scaffolds are collections of templates arranged in a tree structure. To begin, create a template asset by right-clicking anywhere in the project hierarchy and selecting &lt;strong&gt;Create -&amp;gt; Templ -&amp;gt; Scriban Template&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2m2nti9z5lubiodgq2zt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2m2nti9z5lubiodgq2zt.png" alt="Scriban asset inspector" width="708" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The template asset inspector allows editing of the template text. It will also show any syntax errors found in the template and warn if the template is not referenced in &lt;strong&gt;TemplSettings&lt;/strong&gt;. Enter the source code below in the template text area and click &lt;strong&gt;Apply&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;UnityEngine&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;ScriptableObjects&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;CreateAssetMenu&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"newScriptableObject"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;NewScriptableObjectScript&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ScriptableObject&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rename the template to &lt;em&gt;ScriptableObjectScriptTemplate&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Next, right-click anywhere in the project hierarchy and select &lt;strong&gt;Create -&amp;gt; Templ -&amp;gt; Scaffold Definition&lt;/strong&gt;. Once created, name it &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyqsu074u6ygacp3zm0g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyqsu074u6ygacp3zm0g.png" alt="Scaffold inspector" width="464" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The scaffold asset inspector consists of a Default Input field, a toolbar to edit the scaffold tree, and the scaffold tree view. Similarly to the template asset inspector, it will show any errors in the scaffold and warn if it is not referenced in &lt;strong&gt;TemplSettings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;Root&lt;/strong&gt; node in the scaffold tree view and click on the button with the colourful icon in the toolbar to add a template node. Then, name it &lt;em&gt;NewScriptableObjectScript.cs&lt;/em&gt; and drag-&amp;amp;-drop &lt;em&gt;ScriptableObjectScriptTemplate&lt;/em&gt; into the field next to the name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnamfjsnel7ddemsi2bb1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnamfjsnel7ddemsi2bb1.gif" alt="Add template to scaffold" width="806" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The scaffold will generate a single file with the contents of the template. This scaffold is not very useful for now, but it is a good starting point to build upon.&lt;/p&gt;

&lt;p&gt;To generate the scaffold, it must first be set as selectable. Select &lt;strong&gt;TemplSettings&lt;/strong&gt; and, in the inspector, create a new item in the Selectable Scaffolds list and drag-&amp;amp;-drop &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; into it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyt2md7115s6k63e3tj8.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyt2md7115s6k63e3tj8.gif" alt="Set scaffold as selectable" width="806" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, the scaffold is selectable from the context menu. Right-click on any folder in the project hierarchy and select &lt;strong&gt;Generate Templ Scaffold&lt;/strong&gt;. A menu will appear with a single option named &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt;. Clicking on it will generate the scaffold.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nr61icmwybws0g2whws.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nr61icmwybws0g2whws.gif" alt="Generate scaffold" width="806" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Attempting to generate the same scaffold under the same folder will result in a prompt asking which files to overwrite or skip.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxqtebdss8iyzaet3lp8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxqtebdss8iyzaet3lp8.png" alt="Overwrite prompt" width="748" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the template is static, the generated script will always match its contents. This sample scaffold will be extended further below to make it more dynamic. Live entries will be introduced next.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to add a simple live entry
&lt;/h2&gt;

&lt;p&gt;Live entries monitor their input asset for changes and react to them by generating an output asset. To detect changes, input assets must be saved to disk first. Changes to the assets in the Unity Editor are seldom saved to disk automatically. One way to ensure assets are saved to disk is to use the keyboard shortcut &lt;strong&gt;Ctrl/Cmd + S&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Start by renaming the scriptable object script generated earlier from &lt;em&gt;NewScriptableObjectScript&lt;/em&gt; to &lt;em&gt;Windows&lt;/em&gt;. Then, replace its contents with the source code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;UnityEngine&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;CreateAssetMenu&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Windows"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Windows&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ScriptableObject&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;windowList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Right-click anywhere in the project hierarchy and select &lt;strong&gt;Create -&amp;gt; Windows&lt;/strong&gt;. Once the asset is created, proceed to populate the Window List with the following values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Main&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Profile&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Store&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ptv557ltahzsxip1wod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ptv557ltahzsxip1wod.png" alt="Windows scriptable object inspector" width="464" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine this could eventually become the heart of a complex window system for an application. For now, it only lists the names of the windows in the application, but later it could specify how the windows are meant to behave or how to navigate between them.&lt;/p&gt;

&lt;p&gt;Sometimes, it is desirable to have a representation of the data in a scriptable object as constants in C#. An example would be to generate an enum whose values represent the windows in the list above. Every time the window list is updated, the enum will be updated automatically to reflect the changes.&lt;/p&gt;

&lt;p&gt;To achieve this, a template must be defined to convert the data in the scriptable object to an enum script. Right-click anywhere in the project hierarchy and select &lt;strong&gt;Create -&amp;gt; Templ -&amp;gt; Scriban Template&lt;/strong&gt;. Name the template &lt;em&gt;EnumTemplate&lt;/em&gt; and fill its contents with the following text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;OutputAssetPath&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="n"&gt;GetFileNameWithoutExtension&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;{{~&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;window&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;scriptableObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;window_list&lt;/span&gt; &lt;span class="p"&gt;~}}&lt;/span&gt;
        &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;}},&lt;/span&gt;
&lt;span class="p"&gt;{{~&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="p"&gt;~}}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As mentioned earlier, templates are written in the Scriban language. The capabilities of this template engine are explained in more detail further ahead. For now, note that every statement between &lt;code&gt;{{ }}&lt;/code&gt; is a template statement.&lt;/p&gt;

&lt;p&gt;Pay special attention to the &lt;code&gt;for&lt;/code&gt; loop. For each element in the collection, a line is written to the output with the window name, followed by a comma. The &lt;code&gt;end&lt;/code&gt; statement closes the scope of the &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;

&lt;p&gt;In this case, &lt;code&gt;scriptableObject.window_list&lt;/code&gt; represents the list of windows in the scriptable object created earlier. The reason it is named &lt;code&gt;window_list&lt;/code&gt; instead of &lt;code&gt;windowList&lt;/code&gt;, as in the class definition, is due to a Scriban convention which exposes object fields in &lt;em&gt;snake_case&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;To bring everything together, select &lt;strong&gt;TemplSettings&lt;/strong&gt; and, in the inspector window, add a new Scriptable Object entry to the Live Entries list. Next, drag-&amp;amp;-drop the following assets into their respective places:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Windows&lt;/em&gt; scriptable object instance into the Scriptable Object field.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;EnumTemplate&lt;/em&gt; into the Template field.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The folder in the project hierarchy where the enum script should be generated into the Directory field.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lastly, enter &lt;em&gt;WindowNames.cs&lt;/em&gt; in the Filename field and use the keyboard shortcut &lt;strong&gt;Ctrl/Cmd + S&lt;/strong&gt; to save &lt;strong&gt;TemplSettings&lt;/strong&gt; to disk.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxm1vgnjtz5lvspgdphmn.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxm1vgnjtz5lvspgdphmn.gif" alt="Create live entry" width="806" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A logline will appear in the Unity Editor console window showing a template has been rendered. From this moment onwards, a one-way data binding exists between the &lt;em&gt;Windows&lt;/em&gt; scriptable object and the &lt;em&gt;WindowNames&lt;/em&gt; script. Open the &lt;em&gt;WindowNames&lt;/em&gt; script to verify it contains the window list represented as values in an enum definition.&lt;/p&gt;

&lt;p&gt;To test that the live entry works as expected, add a new element to the window list in the &lt;em&gt;Windows&lt;/em&gt; scriptable object and save it to disk using &lt;strong&gt;Ctrl/Cmd + S&lt;/strong&gt;. A new logline will appear in the console window, and the &lt;em&gt;WindowNames&lt;/em&gt; script will be updated to reflect the change in the &lt;em&gt;Windows&lt;/em&gt; scriptable object.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthbzj548ojahgge3kikq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthbzj548ojahgge3kikq.gif" alt="Update Windows scriptable object" width="806" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The data binding is also upheld when the template changes. Replace the contents of &lt;em&gt;EnumTemplate&lt;/em&gt; with the following text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;OutputAssetPath&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="n"&gt;GetFileNameWithoutExtension&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;None&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;{{~&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;window&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;scriptableObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;window_list&lt;/span&gt; &lt;span class="p"&gt;~}}&lt;/span&gt;
        &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;}},&lt;/span&gt;
&lt;span class="p"&gt;{{~&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="p"&gt;~}}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resulting enum will always have a None value followed by the window name values, all denoted by their respective numerical values. Once the template is saved to disk and the logline is shown in the console window, inspect the &lt;em&gt;WindowNames&lt;/em&gt; script to see the changes.&lt;/p&gt;

&lt;p&gt;The fact that the output folder is referenced as an asset means it can be renamed or moved in the project hierarchy without breaking its reference in the live entry. Consequently, the data binding will "follow" the folder as long as it is renamed or moved within the Unity Editor.&lt;/p&gt;

&lt;p&gt;More advanced use cases for live entries will be explored further below. Templates are explained in more detail next.&lt;/p&gt;

&lt;h2&gt;
  
  
  Templates
&lt;/h2&gt;

&lt;p&gt;Even though the &lt;a href="https://github.com/scriban/scriban/blob/master/doc/language.md" rel="noopener noreferrer"&gt;Scriban language&lt;/a&gt; is well documented, there are a few specifics worth noting.&lt;/p&gt;

&lt;p&gt;Several reserved keywords are available as variables in templates. For example, &lt;code&gt;OutputAssetPath&lt;/code&gt; is the output asset path of the generated asset. It is exposed to both live entry and scaffold templates. The rest of the reserved keywords are exclusive to scaffold templates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Input&lt;/code&gt;: Exposes the input object of the scaffold.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Selection&lt;/code&gt;: Exposes the selected asset at the time of generation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Seed&lt;/code&gt;: Exposes a new GUID shared across all the templates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;RootPath&lt;/code&gt;: Exposes the path where the scaffold is generated.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are also various template functions to aid with typical requirements, such as &lt;code&gt;GetFileNameWithoutExtension&lt;/code&gt;. The complete set of template functions available can be explored &lt;a href="https://github.com/willykc/templ/blob/main/Editor/TemplFunctions.cs" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It is worth pointing out that these reserved keyword variables and functions are not exposed in &lt;em&gt;snake_case&lt;/em&gt; as opposed to object fields.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Scriban?
&lt;/h3&gt;

&lt;p&gt;There are many different template engines out there. Scriban was selected primarily because it is open-source, fully featured and provides a flexible API. It is also available as an OpenUPM package through &lt;a href="https://github.com/xoofx/UnityNuGet" rel="noopener noreferrer"&gt;UnityNuGet&lt;/a&gt;, which makes it convenient to reference as a package dependency.&lt;/p&gt;

&lt;p&gt;Scriban provides a &lt;a href="https://marketplace.visualstudio.com/items?itemName=xoofx.scriban" rel="noopener noreferrer"&gt;Visual Studio Code extension&lt;/a&gt; for syntax colouring that simplifies the creation and editing of templates. To make the most of it, rename the extension of C# templates from &lt;em&gt;.sbn&lt;/em&gt; to &lt;em&gt;.sbncs&lt;/em&gt; so that the syntax colouring matches the nature of the template.&lt;/p&gt;

&lt;p&gt;To improve template reusability, the Scriban API allows defining how to reference templates within templates using the &lt;a href="https://github.com/scriban/scriban/blob/master/doc/language.md#911-include-name-arg1argn" rel="noopener noreferrer"&gt;include function&lt;/a&gt;. This means that templates can be included in other templates by specifying their asset paths or GUIDs in Unity, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="err"&gt;{{&lt;/span&gt; &lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="n"&gt;'Assets/Templates/MyTemplate.sbn'&lt;/span&gt; &lt;span class="err"&gt;}}&lt;/span&gt;
&lt;span class="err"&gt;{{&lt;/span&gt; &lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="n"&gt;'a82406792f69d0b4bad506b4d160ac1c'&lt;/span&gt; &lt;span class="err"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use asset paths when it is safe to assume the templates will not be moved to another location in the project hierarchy. Otherwise, use GUIDs to guarantee the reference will not be broken even when moving the templates to a new location. An asset's GUID can be obtained by inspecting the .meta file next to it.&lt;/p&gt;

&lt;p&gt;Another virtue of Scriban is extensibility in the form of custom template functions. Even though Scriban provides a versatile set of &lt;a href="https://github.com/scriban/scriban/blob/master/doc/builtins.md" rel="noopener noreferrer"&gt;built-in functions&lt;/a&gt;, it is convenient to be able to define custom ones to fit specific requirements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining custom template functions
&lt;/h3&gt;

&lt;p&gt;To write a custom template function, declare a &lt;code&gt;public static&lt;/code&gt; class and decorate it with the &lt;code&gt;TemplFunctions&lt;/code&gt; attribute. Any &lt;code&gt;public static&lt;/code&gt; methods implemented under such a class will be automatically exposed as template functions with the same name.&lt;/p&gt;

&lt;p&gt;The following source code exemplifies this by implementing a method that returns the input string with trailing underscores.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Editor&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;TemplFunctions&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TemplFunctionsSample&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nf"&gt;Padding&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;$"_&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;_"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The method is exposed as a template function called &lt;code&gt;Padding&lt;/code&gt;. An example of usage is shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;some text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;Padding&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rendering this template would output the following text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_some text_
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a custom template function is declared with the name of an existing custom template function, an error will appear in the Unity Editor console window detailing the conflict. Asset generation will not function before these conflicts are resolved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaffolds in detail
&lt;/h2&gt;

&lt;p&gt;This section continues the &lt;strong&gt;"How to create a simple scaffold"&lt;/strong&gt; section. It is recommended to read that section before proceeding.&lt;/p&gt;

&lt;p&gt;Scaffolds can be configured to show a prompt for input data when generating them. This allows the output to change depending on the input values. &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt;, defined earlier, can be extended in such a way as to output scriptable object scripts of different names.&lt;/p&gt;

&lt;p&gt;Start by defining a scriptable object class named &lt;em&gt;ScriptableObjectScaffoldInput&lt;/em&gt; to represent the input object of the scaffold, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;UnityEngine&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;CreateAssetMenu&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ScriptableObjectScaffoldInput"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ScriptableObjectScaffoldInput&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ScriptableObject&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;scriptName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Right-click anywhere in the project hierarchy and select &lt;strong&gt;Create -&amp;gt; Scriptable Object Scaffold Input&lt;/strong&gt;. Next, drag-&amp;amp;-drop the newly created &lt;em&gt;ScriptableObjectScaffoldInput&lt;/em&gt; instance into the Default Input field of &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fad45qjsq1qaqhmnb2p2p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fad45qjsq1qaqhmnb2p2p.png" alt="Scaffold with Default Input" width="648" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Double-click on the &lt;em&gt;NewScriptableObjectScript.cs&lt;/em&gt; node in the scaffold tree view and rename it to &lt;em&gt;{{Input.script_name}}.cs&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vo0zlrubbb3llm8bf5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8vo0zlrubbb3llm8bf5r.png" alt="Renamed scaffold node" width="648" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;em&gt;ScriptableObjectScriptTemplate&lt;/em&gt; in the project hierarchy and replace its contents, in the inspector window, with the following text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;UnityEngine&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="err"&gt;{{&lt;/span&gt;&lt;span class="nn"&gt;OutputAssetPath&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="n"&gt;GetDirectoryName&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replace&lt;/span&gt; &lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="err"&gt;\\&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;`&lt;/span&gt; &lt;span class="s"&gt;"."&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;CreateAssetMenu&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"new{{Input.script_name}}"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="err"&gt;{{&lt;/span&gt;&lt;span class="nc"&gt;Input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;script_name&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ScriptableObject&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The class name will now match the input script name. The namespace of the generated script is dynamic as well. It will correspond to its location in the project hierarchy. This technique to obtain a namespace is rudimentary; a custom template function could be implemented to scan the filesystem for assembly definitions that provide the namespace for the script.&lt;/p&gt;

&lt;p&gt;Next, right-click anywhere in the project hierarchy and select &lt;strong&gt;Generate Templ Scaffold&lt;/strong&gt;. Then, click on &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; to generate the scaffold. The following prompt will be shown this time to request input data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhryf1i0035x4g5c5dki.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhryf1i0035x4g5c5dki.png" alt="Scaffold input form" width="627" height="539"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter a sensible scriptable object name, click on &lt;strong&gt;Generate ScriptableObjectScaffold&lt;/strong&gt; at the bottom and inspect the output.&lt;/p&gt;

&lt;p&gt;The input form above shows the inspector for the Default Input scriptable object configured in the scaffold. If a custom inspector is implemented, it will be shown instead of the default inspector. This allows the implementation of custom validation rules for input data.&lt;/p&gt;

&lt;h3&gt;
  
  
  The scaffold tree view and toolbar
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; can be further extended to generate a default serialized instance of the scriptable object class. To begin, select &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; to view it in the inspector window. Then, select the &lt;strong&gt;Root&lt;/strong&gt; node and click on the toolbar button with the folder icon. Name the new folder node &lt;em&gt;DefaultInstance&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzks6qy8zt0ab4lvohz2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzks6qy8zt0ab4lvohz2f.png" alt="Creating a folder node" width="784" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The right-most button in the toolbar is for removing nodes from the scaffold. The button next to it is for cloning nodes. Select the file node on top of the folder node and click on the clone button. Then, drag-&amp;amp;-drop the duplicate node into the folder node.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxachky1vpntu1n4plib0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxachky1vpntu1n4plib0.gif" alt="Cloning a node and reorganizing the scaffold tree" width="781" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The two buttons to the left are to expand or collapse the tree view and to edit nodes. Scaffold trees can have multiple levels of depths and many different nodes. Nodes can be moved in bulk by selecting them together while holding down the &lt;strong&gt;Shift&lt;/strong&gt; key and then dragging them in the tree hierarchy. Multiple nodes can also be cloned or removed simultaneously. Edits to the scaffold tree can be undone or redone as any other action in the Unity Editor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scriptable object YAML node
&lt;/h3&gt;

&lt;p&gt;The next step is to rename the file node inside the folder node to &lt;em&gt;{{Input.script_name}}.asset&lt;/em&gt;. Once renamed, create a new template by right-clicking anywhere in the project hierarchy and selecting &lt;strong&gt;Create -&amp;gt; Templ -&amp;gt; Scriban Template&lt;/strong&gt;. Name it &lt;em&gt;ScriptableObjectInstanceTemplate&lt;/em&gt; and replace its contents with the following text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nt"&gt;%YAML&lt;/span&gt; &lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="nt"&gt;%TAG&lt;/span&gt; &lt;span class="kt"&gt;!u!&lt;/span&gt; &lt;span class="kt"&gt;tag:unity3d.com,2011:&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt; &lt;span class="kt"&gt;!u!114&lt;/span&gt; &lt;span class="nl"&gt;&amp;amp;11400000&lt;/span&gt;
&lt;span class="na"&gt;MonoBehaviour&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;m_ObjectHideFlags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
  &lt;span class="na"&gt;m_CorrespondingSourceObject&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;fileID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;0&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;m_PrefabInstance&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;fileID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;0&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;m_PrefabAsset&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;fileID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;0&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;m_GameObject&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;fileID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;0&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;m_Enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
  &lt;span class="na"&gt;m_EditorHideFlags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
  &lt;span class="na"&gt;m_Script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;fileID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;11500000&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;guid&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;RootPath + Input.script_name | string.md5&lt;/span&gt;&lt;span class="pi"&gt;}},&lt;/span&gt; &lt;span class="nv"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;3&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;m_Name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;Input.script_name&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
  &lt;span class="na"&gt;m_EditorClassIdentifier&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; and double click on the &lt;em&gt;{{Input.script_name}}.asset&lt;/em&gt; node. Then, drag-&amp;amp;-drop &lt;em&gt;ScriptableObjectInstanceTemplate&lt;/em&gt; into the field next to the node name.&lt;/p&gt;

&lt;p&gt;It may seem enough to accomplish the desired goal, but the scaffold is still incomplete. The generated script asset GUID (provided by the Unity Editor) will not match the GUID value in the scriptable object YAML.&lt;/p&gt;

&lt;h3&gt;
  
  
  Meta node
&lt;/h3&gt;

&lt;p&gt;To ensure the script asset GUID matches the GUID in the scriptable object YAML, create a new template with the following text and name it &lt;em&gt;ScriptMetaTemplate&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;fileFormatVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;span class="na"&gt;guid&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;RootPath + Input.script_name | string.md5&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
&lt;span class="na"&gt;MonoImporter&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;externalObjects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;
  &lt;span class="na"&gt;serializedVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
  &lt;span class="na"&gt;defaultReferences&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[]&lt;/span&gt;
  &lt;span class="na"&gt;executionOrder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
  &lt;span class="na"&gt;icon&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;instanceID&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;0&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;userData&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;assetBundleName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;assetBundleVariant&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Clone &lt;em&gt;{{Input.script_name}}.cs&lt;/em&gt; in the scaffold tree and rename the duplicate to &lt;em&gt;{{Input.script_name}}.cs.meta&lt;/em&gt;. Next, drag-&amp;amp;-drop &lt;em&gt;ScriptMetaTemplate&lt;/em&gt; into the corresponding field in the node.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftjgj4gfzmuctd1jszrup.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftjgj4gfzmuctd1jszrup.png" alt="Complete scaffold" width="784" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Generate the scaffold anywhere in the project hierarchy (as shown before) and inspect the output.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dynamic scaffolds
&lt;/h3&gt;

&lt;p&gt;Despite the flexibility of the scaffold tree view, it is static. Once the scaffold is defined, the contents of the files it generates may change, but its structure will remain constant.&lt;/p&gt;

&lt;p&gt;Dynamic scaffolds allow the tree structure to change the same way the contents of the files do; by using a template to determine the tree structure expressed in YAML. This makes it possible to generate a collection of files based on an array of values or conditionally generate specific files depending on the results of a boolean expression.&lt;/p&gt;

&lt;p&gt;For example, a dynamic version of &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; could generate the default instance of the generated scriptable object conditionally, depending on the value of a boolean flag in the default input object.&lt;/p&gt;

&lt;p&gt;Start by creating a new template to generate the tree structure of the dynamic scaffold. Right-click anywhere in the project hierarchy and select &lt;strong&gt;Create -&amp;gt; Templ -&amp;gt; Scriban Template&lt;/strong&gt;. Name it &lt;em&gt;TreeTemplate&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Select &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; and click on the context menu in the inspector window. Then, click on the &lt;strong&gt;Copy YAML Tree&lt;/strong&gt; menu item.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyjtxyke24vnv34f8oyi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyyjtxyke24vnv34f8oyi.png" alt="Scaffold context menu" width="787" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;em&gt;TreeTemplate&lt;/em&gt; and paste the copied YAML into its contents. It will look similar to the following YAML text. The paths to the templates may differ depending on their location in the project hierarchy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{{Input.script_name}}.cs'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assets/Editor/TemplData/ScriptableObjectScriptTemplate.sbn&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{{Input.script_name}}.cs.meta'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assets/Editor/TemplData/ScriptMetaTemplate.sbn&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;DefaultInstance&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{{Input.script_name}}.asset'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assets/Editor/TemplData/ScriptableObjectInstanceTemplate.sbn&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Selecting &lt;strong&gt;Copy YAML Tree with GUIDs&lt;/strong&gt; in the scaffold inspector context menu would produce a YAML representation of the scaffold tree with GUID references instead of asset paths.&lt;/p&gt;

&lt;p&gt;Next, add &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt; statements to &lt;em&gt;TreeTemplate&lt;/em&gt; as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{{Input.script_name}}.cs'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assets/Editor/TemplData/ScriptableObjectScriptTemplate.sbn&lt;/span&gt;
&lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;~ if Input.generate_default_instance ~&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{{Input.script_name}}.cs.meta'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assets/Editor/TemplData/ScriptMetaTemplate.sbn&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;DefaultInstance&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{{Input.script_name}}.asset'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assets/Editor/TemplData/ScriptableObjectInstanceTemplate.sbn&lt;/span&gt;
&lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;~ end ~&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The default instance will now be generated depending on the value of &lt;code&gt;Input.generate_default_instance&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Extend the ScriptableObjectScaffoldInput class to include the boolean field, as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;UnityEngine&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;CreateAssetMenu&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"ScriptableObjectScaffoldInput"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ScriptableObjectScaffoldInput&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ScriptableObject&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;scriptName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;generateDefaultInstance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Afterwards, create a dynamic scaffold by right-clicking anywhere in the project hierarchy and selecting &lt;strong&gt;Create -&amp;gt; Templ -&amp;gt; Dynamic Scaffold Definition&lt;/strong&gt;. Name it &lt;em&gt;ScriptableObjectDynamicScaffold&lt;/em&gt;. Then, drag-&amp;amp;-drop &lt;em&gt;ScriptableObjectScaffoldInput&lt;/em&gt; into the Default Input field and &lt;em&gt;TreeTemplate&lt;/em&gt; into the Tree Template field.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdrjisy7r5ua3wh6rw4bc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdrjisy7r5ua3wh6rw4bc.png" alt="Dynamic scaffold inspector" width="785" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, select &lt;strong&gt;TemplSettings&lt;/strong&gt; and, in the inspector, replace &lt;em&gt;ScriptableObjectScaffold&lt;/em&gt; with &lt;em&gt;ScriptableObjectDynamicScaffold&lt;/em&gt; in the Selectable Scaffolds list.&lt;/p&gt;

&lt;p&gt;Generate the new scaffold multiple times and experiment with the boolean flag to see the results.&lt;/p&gt;

&lt;p&gt;This concludes the detailed overview of scaffolds. The following section will describe advanced use cases for live entries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other types of live entries
&lt;/h2&gt;

&lt;p&gt;There are two default live entry types, Scriptable Object and Assembly Definition. The former was exemplified earlier, while the latter allows monitoring for changes in source code and generates an output asset based on the contents of a compiled assembly. It is exposed to templates as &lt;code&gt;assembly&lt;/code&gt; while a set of template functions allow manipulating it using reflection.&lt;/p&gt;

&lt;p&gt;The Assembly Definition entry type is ideal for taking code reflection from runtime to design time. A list of constants can be generated from the subclasses of a specific class or the fields of a custom attribute. Several examples of usage are included in the Templ package samples, as described later.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to create a custom live entry
&lt;/h3&gt;

&lt;p&gt;Suppose a JSON text asset with a specific data structure is to be used to generate another text asset. Start by creating a script to define the data structure. Name it &lt;em&gt;JsonData&lt;/em&gt; and replace its contents with the following source code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Collections.Generic&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JsonData&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To write a custom entry type, extend the &lt;code&gt;TemplEntry&lt;/code&gt; class, decorate it with the &lt;code&gt;TemplEntryInfo&lt;/code&gt; attribute and define a public field of the target asset type decorated with the &lt;code&gt;TemplInput&lt;/code&gt; attribute.&lt;/p&gt;

&lt;p&gt;Produce a new script anywhere in the project hierarchy and name it &lt;em&gt;JsonEntry&lt;/em&gt;. Then, replace its contents with the source code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;UnityEngine&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Willykc.Templ.Samples&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Editor.Entry&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;TemplEntryInfo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;changeTypes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ChangeType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Import&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DisplayName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"JSON"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;JsonEntry&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;TemplEntry&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;TemplInput&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;TextAsset&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="n"&gt;InputValue&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;JsonUtility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;FromJson&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;JsonData&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;IsValidInputField&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;get&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;try&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsValidInputField&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;InputValue&lt;/span&gt; &lt;span class="p"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="k"&gt;catch&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;TemplEntryInfo&lt;/code&gt; attribute allows the specification of change type (in this case &lt;code&gt;ChangeType.Import&lt;/code&gt;) and defines the display name of the entry type in the &lt;strong&gt;TemplSettings&lt;/strong&gt; inspector (JSON in this case).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;json&lt;/code&gt; field is the input asset of the entry. It must always be public and decorated with the &lt;code&gt;TemplInput&lt;/code&gt; attribute. In this case, it is of type &lt;code&gt;TextAsset&lt;/code&gt;. It must always be a subtype of the &lt;code&gt;UnityEngine.Object&lt;/code&gt; class.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;InputValue&lt;/code&gt; property override allows defining the object instance exposed to the templates. In this case, the JSON text is parsed and exposed as an instance of the &lt;code&gt;JsonData&lt;/code&gt; class. This allows the templates to interact with a data structure rather than just a JSON string value.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;IsValidInputField&lt;/code&gt; property override determines if the entry is valid or not. In this case, if the JSON text fails to parse, then the entry is considered invalid.&lt;/p&gt;

&lt;p&gt;A few more details about implementing custom live entries can be found &lt;a href="https://github.com/willykc/templ#custom-entries" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Open a file explorer and create a sample JSON file anywhere under the project's Assets hierarchy. Name it &lt;em&gt;SampleJson.json&lt;/em&gt; and enter the following text in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sample"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"list"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"one"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"two"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, create a new template by right-clicking anywhere in the project hierarchy and selecting &lt;strong&gt;Create -&amp;gt; Templ -&amp;gt; Scriban Template&lt;/strong&gt;. Name it &lt;em&gt;YamlTemplate&lt;/em&gt; and fill its contents with the following text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;json.name&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
&lt;span class="s"&gt;list:{{if json.list | array.size == 0}} []{{end}}&lt;/span&gt;
&lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;~ for item in json.list ~&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;item&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
&lt;span class="pi"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;~ end ~&lt;/span&gt;&lt;span class="pi"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;strong&gt;TemplSettings&lt;/strong&gt; inspector, expand the dropdown to add new entries. A JSON entry type will be available, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbu9vrvfv13l21d0lzpiu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbu9vrvfv13l21d0lzpiu.png" alt="JSON menu entry" width="695" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add a new JSON entry and drag-&amp;amp;-drop &lt;em&gt;SampleJson&lt;/em&gt; into the JSON field, &lt;em&gt;YamlTemplate&lt;/em&gt; into the Template field, any folder in the project hierarchy into the Directory field, and enter &lt;em&gt;SampleYaml.yml&lt;/em&gt; in the Filename field.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkku2i4yc614umdp9guj5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkku2i4yc614umdp9guj5.png" alt="JSON live entry" width="696" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;strong&gt;Ctrl/Cmd + S&lt;/strong&gt; on your keyboard to save &lt;strong&gt;TemplSettings&lt;/strong&gt; to disk. Inspect the output and experiment by editing the &lt;em&gt;SampleJson.json&lt;/em&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Samples
&lt;/h2&gt;

&lt;p&gt;The Templ package includes many samples to showcase the capabilities discussed before and more. Select &lt;strong&gt;Window -&amp;gt; Package Manager&lt;/strong&gt; and select Templ in the packages list. Then, expand the Samples foldout to reveal the list of samples.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmidbdut472jrn5dsljt3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmidbdut472jrn5dsljt3.png" alt="List of samples" width="617" height="672"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;Import&lt;/strong&gt; to copy a sample into the project hierarchy. Each contains all the assets necessary to utilize the capabilities in a specific manner. They are a good starting point when working on an asset generation project.&lt;/p&gt;

&lt;h2&gt;
  
  
  API
&lt;/h2&gt;

&lt;p&gt;An API is provided to enable further automation of asset generation. It can generate scaffolds within custom editor windows and add, update or remove live entries. It is fully &lt;a href="https://github.com/willykc/templ#public-api" rel="noopener noreferrer"&gt;documented&lt;/a&gt;, and some of the samples showcase its usage.&lt;/p&gt;

&lt;p&gt;To access the API, reference the &lt;code&gt;TemplManagers&lt;/code&gt; static class. The properties of this class expose the available operations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;TemplManagers.ScaffoldManager&lt;/code&gt;: Exposes scaffold operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;TemplManagers.EntryManager&lt;/code&gt;: Exposes live entry operations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following is an example of how to use the API to generate a scaffold.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;TemplManagers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ScaffoldManager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GenerateScaffoldAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;scaffold&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;targetPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;overwriteOption&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;OverwriteOptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OverwriteAll&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is an asynchronous operation since it can prompt the user to input data. The &lt;code&gt;scaffold&lt;/code&gt; parameter is an instance of a scaffold asset. The &lt;code&gt;targetPath&lt;/code&gt; parameter is the asset path to the folder where the scaffold is meant to be generated. The &lt;code&gt;overwriteOption&lt;/code&gt; parameter determines what happens if already existing files are encountered during generation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Known issues and limitations
&lt;/h2&gt;

&lt;p&gt;When using the &lt;code&gt;include&lt;/code&gt; function in live entry templates, changes to the included templates will not trigger the rendering of the entry as a change to the direct template would.&lt;/p&gt;

&lt;p&gt;A live entry generating an asset which triggers another generation is considered an import feedback loop. To prevent this, live entries will not be rendered when configured to overwrite the input asset or the template of any other entry. The same restriction applies to entries configured to overwrite &lt;strong&gt;TemplSettings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Assembly Definition entries are still susceptible to feedback loops since assembly definitions are associated with multiple script assets. Do not generate a script within the assembly definition associated with the entry. Also, any build issues caused by removing an assembly definition reference will prevent any associated live entry from rendering until the build issues are fixed.&lt;/p&gt;

&lt;p&gt;Neither &lt;strong&gt;TemplSettings&lt;/strong&gt; nor templates can be used as the input of a Scriptable Object entry.&lt;/p&gt;

&lt;p&gt;Live entries are only capable of generating a single output asset. Some consideration was given to using scaffolds as live entries output, but that would make import feedback loops harder to prevent.&lt;/p&gt;

&lt;p&gt;The dependencies referenced as UPM packages can cause conflicts in the Unity build process. The most likely manifestation of this issue is with the &lt;code&gt;system.threading.tasks.extensions&lt;/code&gt; package. Plugin conflicts must be resolved by disabling the offending plugins for the build using the Unity Editor's &lt;a href="https://docs.unity3d.com/ScriptReference/PluginImporter.html" rel="noopener noreferrer"&gt;PluginImporter API&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>unity3d</category>
      <category>codegeneration</category>
      <category>declarative</category>
      <category>templates</category>
    </item>
  </channel>
</rss>
