版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32225289/article/details/88966963
//=====================================================
// - FileName: #SCRIPTNAME#.cs
// - Author: #AuthorName#
// - CreateTime: #CreateTime#
// - Email: #AuthorEmail#
// - Description:
// - (C) Copyright 2019, webeye,Inc.
// - All Rights Reserved.
//======================================================
using UnityEngine;
using System.Collections;
using System.IO;
public class Copyright : UnityEditor.AssetModificationProcessor
{
private const string AuthorName = "Autumn";
private const string AuthorEmail = "[email protected]";
private const string DateFormat = "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(DateFormat));
File.WriteAllText(path, allText);
UnityEditor.AssetDatabase.Refresh();
}
}
}