Synchronize custom C # file templates for Unity team programs

Source: Internet
Author: User

Sun Guangdong 2015.7.30

is to put the program template (no matter who can change and sync git) in the Unity Project Editor directory, when the program created a C # script is the template.

"81-c# script-newbehaviourscript.cs.txt" file

Using unityengine;using system.collections.generic;namespace dajiagame.px{    //<summary>//Description:     ///Author://</summary>[addcomponentmenu ("dajiagame/px/#SCRIPTNAME #")] public    class # scriptname#: Monobehaviour    {        //initialization function        private void Start ()        {        }        //per frame update        private void Update ()        {        }    }}/* =============== hint:  feature related ================= *  [Serializefield] *  [ Hideininspector] *  [Requirecomponent (typeof (Rigidbody))] *  [Serializefield, Range (0,5)]    int[] Counts * [  Serializefield,tooltipattribute ("description")] * [  serializefield,headerattribute ("Title")] *  [ Serializefield,textareaattribute (2, 5)]     string message2; *  [disallowmultiplecomponent]             //Cannot add script repeatedly *  [Addcomponentmenu ("dajiagame/px")] *  [Executeineditmode] */



-----------------------------------------------------------------------//<copyright file= "ComAnimation.cs" company= "Game Development Laboratory" >//Copyright (c) Sprocket enterprises. All rights reserved.//</copyright>//<author> sunguangdong </author>////<summary>// The Widget class.//</summary>//----------------------------------------------------------------------- Using unityengine;using system.collections;using unityeditor;using system.io;namespace DajiaGame.Px{//<summary&    Gt Copy of the custom C # script template. Installation path from Project Editor to Unity///Sunguangdong//</summary> public class Copycsharpscripttemplates:monobehavio ur {[initializeonload] public class Startup {//D:/program files/unity5/editor/unity                 . exe//D:\Program files\unity5\editor\data\resources\scripttemplates static Startup () { String stroripath = Path.Combine (applicatiOn.datapath, "editor/81-c# script-newbehaviourscript.cs.txt"); String strdespath = Path.Combine (Path.getdirectoryname (Editorapplication.applicationpath), "Data/Resour                ces/scripttemplates/81-c# script-newbehaviourscript.cs.txt ");            File.Copy (Stroripath, Strdespath, true); }        }    }}


Depending on the use of Git or svn above two files will be synchronized. Then each time the member restarts the Unity editor will trigger a copy of the template file.



??

Synchronize custom C # file templates for Unity team programs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.