Synchronously customizes the C # file template of the Unity Team program,

Source: Internet
Author: User

Synchronously customizes the C # file template of the Unity Team program,

Sun Guangdong

Put the template developed by the Program (anyone can change and synchronize git) in the Editor folder of the unity project. After the program creates a new C # script, it 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 () {}// Update private void Update () per frame () {}}/ * ======================== prompt: 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] // The script cannot be added repeatedly * [AddComponentMenu ("DajiaGame/Px")] * [ExecuteInEditMode] */



// ------------------------------------------------------------------------- // <Copyright file = "ComAnimation. cs "company =" Game Development Laboratory "> // Copyright (c) Sprocket website ISES. all rights reserved. /// </copyright> // <author> SunGuangDong </author> /// <summary> // This is the Widget class. // </summary> // ----------------------------------------------------------------------------- using UnityEngine; using System. collections; using UnityEditor; using System. IO; namespace DajiaGame. px {// <summary> /// copy the custom C # Script Template, installation path from project Editor to Unity // sunguangdong /// </summary> public class CopyCSharpScriptTemplates: MonoBehaviour {[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/Resources/ScriptTemplates/81-C # Script-NewBehaviourScript.cs.txt"); File. copy (strOriPath, strDesPath, true );}}}}


Based on the use of git or svn, the above two files will be synchronized, and each time the members restart the unity editor, the template file copy will be triggered.



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.