创建个脚本,把下面的代码复制粘贴就行了,大部分团队项目都再用的方法
using UnityEngine;
using System.Collections;
using System.IO;
public class Code : UnityEditor.AssetModificationProcessor
{
private static string annotationStr =
"//====================================\r\n"
+ "//描 述 : \r\n"
+ "//作 者 :某作者 \r\n"
+ "//创建时间 :#Time# \r\n"
+ "//版 本 :1.1 \r\n"
+ "// ===============================================\r\n";
private static void OnWillCreateAsset(string path)
{
path = path.Replace(".meta", "");
if (path.EndsWith(".cs"))
{
annotationStr += File.ReadAllText(path);
annotationStr = annotationStr.Replace("#Time#",
System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
File.WriteAllText(path, annotationStr);
}
//Debug.Log(path);
}
}
下面是新创建的脚本展示的效果
代码搬运工