Generate Scripts in Unity3d from Templates

For the TL;DR Watch the YouTube Video.

I just submitted my plugin to the Unity Asset Store.

The plugin

I was doing with you tutorial for test-driven development and unity ( I found that in order to write a tests that had all of the components for the humble object pattern I was forced to write 4 files every time I wanted to create a Mono Behavior. This quickly showed me that I needed to produce a templating system in the unity editor in order to produce these files every time. I then thought back to my earlier game development difficulties and realized that the ability to generate scripts with actually be an extremely helpful tool.

When putting together the system for templating I realized also that I have an organizational pattern in my projects. This pattern requires you to create a folder structure. That made it clear that the pattern should also work in the folder structure along with the templating system.

With the plugin you can now go to the create menu when building assets and select generate from template and a menu will pop up with the various templates available.

In order to replace text in the file path file names or content we put a pound sign in front and at the end of each string just like the templates that are in default Unity Scripts.

This plugin will be the first time I attempt to put anything on the Unity asset store let’s hope it makes it up there. This tool will be useful to me regardless and without it I can not easily implement the humble object pattern with mono behaviors.


Post a Comment