建立文件夹体系

Editor:工具

修改C#编辑的模板:

寻找到Unity下的文件:

MMORPG手游制作-任务3.Unity项目结构和C#编辑模板

结合Editor文件夹下编辑脚本对内容替换

using UnityEngine;
using System.Collections;
using System.IO;
using System;
using UnityEditor;


/// <summary>
/// 替换代码注释
/// </summary>
public class ScriptCreatInit : UnityEditor.AssetModificationProcessor 
{
    private static void OnWillCreateAsset(string path)
    {
        path = path.Replace(".meta","");
        if (path.EndsWith(".cs"))
        {
            string strContent = File.ReadAllText(path);
            strContent = strContent.Replace("#AuthorName#", "悠长de小巷")
                .Replace("#CreateTime#", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                );
            File.WriteAllText(path, strContent);
            AssetDatabase.Refresh();
        }
    }
}


相关文章:

  • 2021-12-14
  • 2021-06-12
  • 2021-07-10
  • 2021-06-10
  • 2021-04-01
  • 2021-05-24
猜你喜欢
  • 2021-04-30
  • 2021-11-20
  • 2021-08-09
  • 2021-05-27
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案