国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

Unity 及 VS2015 創(chuàng)建腳本時(shí)自動(dòng)添加頭部注釋

2019-11-10 18:48:21
字體:
供稿:網(wǎng)友

首先來看下Unity:

在Editor文件夾下創(chuàng)建腳本如下:

using UnityEngine;using System.Collections;using System.IO;namespace UGUIFrameWorkEditor{ public class ChangeScriptTemplates : UnityEditor.AssetModificationPRocessor { // 添加腳本注釋模板 private static string str = "http:// ========================================================/r/n" + "http:// Des:/r/n" + "http:// Autor:阿童木 /r/n" + "http:// CreateTime:#CreateTime#/r/n" + "http:// 版 本:v 1.0/r/n" + "http:// ========================================================/r/n"; // 創(chuàng)建資源調(diào)用 public static void OnWillCreateAsset(string path) { // 只修改C#腳本 path = path.Replace(".meta", ""); if (path.EndsWith(".cs")) { string allText = str; allText += File.ReadAllText(path); // 替換字符串為系統(tǒng)時(shí)間 allText = allText.Replace("#CreateTime#", System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); File.WriteAllText(path, allText); } } }}

當(dāng)我們創(chuàng)建腳本的時(shí)候就會(huì)自動(dòng)添加頭部注釋了。

再來看看VS2015

因?yàn)槲覀冇袝r(shí)候不想在unity中創(chuàng)建腳本,想在vs中進(jìn)行創(chuàng)建,這樣就不需要每次創(chuàng)建腳本unity都要進(jìn)行編譯。 我們找到F:/vs2015/Common7/IDE/ItemTemplatesCache/CSharp/Code/1033/WebClass(這是我的路徑)下的Class腳本,打開是這樣:

using System;using System.Collections.Generic;$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;$endif$using System.Web;namespace $rootnamespace${ public class $safeitemrootname$ { }}

我們需要在它上方添加如下:

/**** 功 能:* 類 名: $safeitemname$** Ver Time Autor Des* ───────────────────────────────────* V0.01 $time$ 阿童木 初版**/?using System;using System.Collections.Generic;$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;$endif$using System.Web;namespace $rootnamespace${ public class $safeitemrootname$ { }}

接著再找到F:/vs2015/Common7/IDE/ItemTemplatesCache/CSharp/Code/2052/Class路徑下的Class, 將它修改為:

/**** 功 能:* 類 名: $safeitemname$** Ver Time Autor Des* ───────────────────────────────────* V0.01 $time$ 阿童木 初版**/?using System;using System.Collections.Generic;$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;$endif$using System.Text;$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;$endif$namespace $rootnamespace${ class $safeitemrootname$ { }}

然后我們每次在vs中創(chuàng)建一個(gè)腳本都會(huì)自動(dòng)添加頭部注釋了。


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 松溪县| 利川市| 会昌县| 年辖:市辖区| 离岛区| 桃源县| 凤台县| 密云县| 郧西县| 台南市| 乌拉特后旗| 壶关县| 常熟市| 潜山县| 休宁县| 鄯善县| 奎屯市| 梓潼县| 五家渠市| 浦北县| 沂源县| 土默特左旗| 玉树县| 明水县| 察隅县| 台州市| 凤城市| 仁化县| 眉山市| 新民市| 益阳市| 林州市| 怀化市| 金阳县| 酒泉市| 安乡县| 翼城县| 洪湖市| 南宁市| 锡林郭勒盟| 交城县|