Unity 安裝目錄:.\Editor\Data\Resources\ScriptTemplates
如修改cs 腳本註釋:
原腳本樣板:
using System.Collections.Generic;
using UnityEngine;
void Start () {
#NOTRIM#
}
// Update is called once per frame
void Update () {
#NOTRIM#
}
}
改成 :
/************************************************************************************
Copyright : Copyright 2017 #SMARTDEVELOPERS#, LLC. All Rights reserved.
Description : #SCRIPTNAME#.#FILEEXTENSION#
ProductionDate : #CREATIONDATE#
Author : T-CODE
************************************************************************************/
using System.Collections.Generic;
using UnityEngine;
void Start () {
#NOTRIM#
}
// Update is called once per frame
void Update () {
#NOTRIM#
}
}
/************************************************************************************ Copyright : Copyright 2017 XinYueVR, LLC. All Rights reserved. Description : HEScriptKeywordReplace.cs ProductionDate : 2017-02-06 19:01:00 Author : T-CODE ************************************************************************************/ using UnityEngine; using System.Collections; using UnityEditor; public class HEScriptKeywordReplace : UnityEditor.AssetModificationProcessor { public static void OnWillCreateAsset(string path) { path = path.Replace(".meta", ""); int index = path.LastIndexOf("."); string file = path.Substring(index); if (file != ".cs" && file != ".js" && file != ".boo") return; string fileExtension = file; index = Application.dataPath.LastIndexOf("Assets"); path = Application.dataPath.Substring(0, index) + path; file = System.IO.File.ReadAllText(path); file = file.Replace("#CREATIONDATE#", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); file = file.Replace("#PROJECTNAME#", PlayerSettings.productName); file = file.Replace("#SMARTDEVELOPERS#", PlayerSettings.companyName); file = file.Replace("#FILEEXTENSION#", fileExtension); System.IO.File.WriteAllText(path, file); AssetDatabase.Refresh(); } }