编辑器模式下 新的资源都是唯一的GUID 调用的方法
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System;
using UnityEditor;
public class ScriptsCreateInit : UnityEditor.AssetModificationProcessor {
private static void OnWillCreateAsset(string path)
{
Debug.Log(path);
path = path.Replace(".meta","");
if (path.EndsWith(".cs"))
{
Debug.Log("true");
string strContent = File.ReadAllText(path);
strContent = strContent.Replace("#AuthorName#", "XXX").Replace("#CreateTime#", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
File.WriteAllText(path,strContent);
AssetDatabase.Refresh();
}
}
}
是因为你的xml 表的保存格式不是utf-8的重新保存一下