Search Unity

[Free Editor Tool] Template Class File Tool

Discussion in 'Assets and Asset Store' started by ldaughtry, Apr 28, 2015.

  1. ldaughtry

    ldaughtry

    Joined:
    Oct 30, 2012
    Posts:
    38
    I made a tool to make generating custom classes a bit easier. It allows you to specify any number of template files with <CLASSNAME> tags as well as optional <INHERIT> and <NAMESPACE> tags. You can then rename the supported tags as needed.

    The attached zip has two files in it:
    • CustomTemplates.zip - Unzip and place the CustomTemplates folder within at the same level as your /Assets directory in your project (this is so that the script files won't be compiled and throw a bunch of errors because of the tags).
    • TemplateClassTool.unitypackage - Import this into your project to get the tool.

    To use:
    1. Right click anywhere in the Project view you want to create a class file from a template.
    2. Select Create > Class From Template.
    3. Select the template you want to use.
    4. Edit the classname, inheritance and namespace as needed in the provided UI.

    Some features:

    • Make as many template files as you need for all applications.
    • Inheritance and Namespace settings are remembered as an EditorPref.
    • Performs some simple file name clashing prevention. Will not overwrite existing files.

    This tool has saved me a lot of time on projects in my heavy implementation phases and helped my code stay consistent with less effort. I hope you all enjoy!

    I work exclusively in C# though it should work for .js or .boo files just fine. I've used it on OSX and PC workstations. This tool is presented as is and I'm afraid I'm too busy to provide any meaningful support. I'll answer questions posted here as able though.
     

    Attached Files:

    Last edited: Apr 28, 2015
    boysenberry likes this.
  2. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    Thanks, much appreciated.