一个小工具,可以和脚本模板兼容
代码如下
public class ScriptChange : UnityEditor.AssetModificationProcessor
{
static string namespaceName = "Mer";
/// <summary>
/// 将要创建资源时会调用这个函数
/// </summary>
static void OnWillCreateAsset(string path)
{
//导入资源的路径,不知道具体是什么的时候建议输出查看
Debug.Log(path);
string str = path.Replace(".meta","");
string[] splitArgs = str.Split('.');
if (splitArgs[splitArgs.Length - 1].Equals("cs"))
{
//Debug.Log("导入的是脚本");
string[] newSplitArgs = str.Split('/');
bool isEditor = false;
foreach (var item in newSplitArgs)
{
if (item.Equals("Editor"))
{
isEditor = true;