Unity打包后事件调用记录

public class BuildAfter:Editor
{
    
    
    /// <summary>
    /// 程序打包完成后执行的回调
    /// </summary>
    /// <param name="target"></param>
    /// <param name="pathToBuiltProject"></param>
    [PostProcessBuild(1)]
    public static void AfterBuild(BuildTarget target, string pathToBuiltProject)
    {
    
    
        Debug.Log("Build Success  输出平台: " + target + "  输出路径: " + pathToBuiltProject);

        //判断平台
        if (target == BuildTarget.WebGL)
        {
    
    
            //读取源文件路径
            string sourcePath = Application.dataPath + "/BuildAfterFiles/index.html";
            ReplaceProductName(sourcePath, pathToBuiltProject + "/index.html",PlayerSettings.productName);
            Debug.Log(string.Format("写入ProductName,sourcePath={0},bulidPath={1}", sourcePath, pathToBuiltProject));
        }
    }
}

猜你喜欢

转载自blog.csdn.net/chillxiaohan/article/details/124146953