QuanYi/Assets/Editor/CreateNewScript.cs
2025-05-09 10:20:30 +08:00

34 lines
1.1 KiB
C#

/// <summary>
///********************************************************
/// 创建人:
/// 创建时间: #CreateTime#
/// 描述: 更改头文件注释
///********************************************************
/// <summary>
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();
}
}
}