建立文件夹体系
Editor:工具
修改C#编辑的模板:
寻找到Unity下的文件:
结合Editor文件夹下编辑脚本对内容替换
using UnityEngine;
using System.Collections;
using System.IO;
using System;
using UnityEditor;
/// <summary>
/// 替换代码注释
/// </summary>
public class ScriptCreatInit : UnityEditor.AssetModificationProcessor
{
private static void OnWillCreateAsset(string path)
{
path = path.Replace(".meta","");
if (path.EndsWith(".cs"))
{
string strContent = File.ReadAllText(path);
strContent = strContent.Replace("#AuthorName#", "悠长de小巷")
.Replace("#CreateTime#", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
);
File.WriteAllText(path, strContent);
AssetDatabase.Refresh();
}
}
}