Unity 发布PC 平台取消创建[ProjectName]_BurstDebugInformation_DoNotShip 文件夹

Unity 版本

Unity 2021.3.15f1

问题描述

Unity 发布PC 平台软件时,比旧版本Unity 发布多创建了一个ProductName_BurstDebugInformation_DoNotShip 文件夹,文件夹里是一个.txt 文本,用来查看和调试当前包的信息,但偶有不需要这个文件夹存在的情况。查过之后发现ProductName_BurstDebugInformation_DoNotShip 文件夹是可忽略或删除的,言外之意就是可以在发布成功后手动删除,但每次发布都手动删除比较麻烦。

解决 

通过设置取消创建

Question - Fail_BurstDebugInformation_DoNotShip - Unity Forumicon-default.png?t=N7T8https://forum.unity.com/threads/fail_burstdebuginformation_donotship.1447171/编辑器里Edit → Project Settings → Burst AOT Settings 找到Enable Burst Compilation 并取消勾选可以实现在发布时不创建ProductName_BurstDebugInformation_DoNotShip 文件夹。

但是Unity 官方技术人员表示这不是个良方,取消Brust 会导致发布后的软件运行变慢。

发布成功后自动删除 

BurstDebugInformation_DoNotShip in builds - Unity Forumicon-default.png?t=N7T8https://forum.unity.com/threads/burstdebuginformation_donotship-in-builds.1172273/不能取消Burst 那就只能回到创建后再删除,使用代码实现在发布成功后自动删除避免了每次发布都要手动删除的麻烦。

try
{
    string applicationName = Path.GetFileNameWithoutExtension(outputPath);
    string outputFolder = Path.GetDirectoryName(outputPath);
    Assert.IsNotNull(outputFolder);
    outputFolder = Path.GetFullPath(outputFolder);

    //Delete Burst Debug Folder
    string burstDebugInformationDirectoryPath = Path.Combine(outputFolder, ${applicationName}_BurstDebugInformation_DoNotShip");

    if (Directory.Exists(burstDebugInformationDirectoryPath))
    {
        Debug.Log($" > Deleting Burst debug information folder at path '{burstDebugInformationDirectoryPath}'...");

        Directory.Delete(burstDebugInformationDirectoryPath, true);
    }
}
catch (Exception e)
{
    Debug.LogWarning($"An unexpected exception occurred while performing build cleanup: {e}");
}

把脚本放入Editor 文件夹下再进行发布即可

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值