tools – How to create a directory template in Unity?

How to create a directory from a template with multiple files in it which are also created from templates?

Right now, I am particularly interested in creating an Assembly directory which uses a user-entered variable ASSEMBLY_NAME, take the project name variable from the settings and would create the following simple file hierarchy:

  • ${ASSEMBLY_NAME}/
    • ${PROJECT_NAME}.${ASSEMBLY_NAME}.asmdef

where the ${PROJECT_NAME}.${ASSEMBLY_NAME}.asmdef file would contain:

{
  "name": "${PROJECT_NAME}.${ASSEMBLY_NAME}"
}

… but I would also be glad to learn any way to create whatever complex templated hierarchies, like creating a class and a companion test script together at once, create a directory with a “readme” file in it, etc.

I know this is somehow possible, because there is a default Unity UI function which does exactly the same, but for test assemblies only, so it adds extra code in the assembly definition file which I don’t need.

enter image description here

I cannot find anything on this topic apart from answers on how to create/edit a single file templates, e.g.: