/// ///******************************************************** /// 创建人: /// 创建时间: #CreateTime# /// 描述: 更改头文件注释 ///******************************************************** /// using System.IO; using System; using UnityEditor; [Obsolete] public class CreateNewScript : AssetModificationProcessor { //private const string AuthorName = "true."; //private const string AuthorEmail = "1670328571@qq.com"; private const string CreateTime = "yyyy/MM/dd HH:mm:ss"; private static void OnWillCreateAsset(string path) { path = path.Replace(".meta", ""); if (path.EndsWith(".cs")) { string allText = File.ReadAllText(path); //allText = allText.Replace("#AuthorName#", AuthorName); //allText = allText.Replace("#AuthorEmail#", AuthorEmail); allText = allText.Replace("#CreateTime#", System.DateTime.Now.ToString(CreateTime)); File.WriteAllText(path, allText); AssetDatabase.Refresh(); } } }