Giter Club home page Giter Club logo

leostemplater's Introduction

Leo's Templater

Do you ever want to create a simple C# script file, but Unity's default script comes with a lot of padding?

Leo's Templater provides an easy way to create different kinds of scripts, just the way you like them. Use the default scripts that come with the package or create your own, change the way you create scripts.

The templates will appear under Create/Templates.

Features

  • Generate scripts using templates
  • Add Header and/or Footer to created scripts
  • Built-in templates (C# Class, Interface, Scriptable Object)
  • Support subfolder templates (Will appear in sub menus in the templates)

Installation

Installing as GIT dependency via Package Manager

  1. Open Package Manager (Window -> Package Manager)

  2. Click + button on the upper left of the window, select "Add mpackage from git URL...'

  3. Enter the following URL and click the Add button

    https://github.com/Mercury-Leo/LeosTemplater.git
    

How to Create a new Template

To create a new Template first you must change the Templater to search for custom templates. To change the templates folder location go to Edit/Preferences/Leo's Tools/Templates select the new template folder location.

Creating the template

First create a new file inside the Templates folder, {templateName}.cs.txt Edit the file to your specification.

This is a basic script template:

namespace #NAMESPACE# 
{
	public class #SCRIPTNAME# 
	{
	    #NOTRIM#
	}
}
  • '#NAMESPACE#' will automatically try and assign the correct namespace to the generated script.
  • '#SCRIPTNAME#' will assign the script name when generated.
  • '#NOTRIM#' prevents an empty space from being deleted.

Adding Header and Footer

To change the Header and Footer of scripts head to Edit/Project Settings/Leo's Tools/Templates.

Edit the Header and Footer to your liking, both will appear commented out at the top and bottom of the genereated script respectfully.

Examples

Scriptable object

using UnityEngine;

namespace #NAMESPACE# 
{
    [CreateAssetMenu(fileName = "new#SCRIPTNAME#", menuName = "#SCRIPTNAME#")]
    public class #SCRIPTNAME# : ScriptableObject 
    {
        #NOTRIM#
    }
}

leostemplater's People

Contributors

mercury-leo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.