この記事でのバージョン
Unity 6000.0.34f1
はじめに
Unityで実機用にビルドすると
〇〇_BurstDebugInformation_DoNotShipという感じのフォルダが生成されることがあります。
![]() |
今回はこれがどういうもので、必要なのかどうかという話です!
BurstDebugInformation_DoNotShip
まず、そもそもこれがなんなのかというと、名前の通りBurstのデバッグ用でファイルで、
DoNotShipとある通り、ユーザーへ配布する必要のない開発者向けファイルです。
https://discussions.unity.com/t/burstdebuginformation-donotship-in-builds/856101/20
なので、リリース時は消せばいいのですが、いちいち消すのも面倒なので、
Project Settings / Burst / AOT SettingsのForce Debug Informationをオフにすれば
リリースビルド時は生成されなくなるらしいです。
(Enable Burst CompilationをオフにすればBurst自体を無効化もできる)
![]() |
ただ、自分の環境だと上記をオフにしても生成される時があった(生成されない時もある)ので、
以下のような生成された時にフォルダごと削除するエディタ拡張を作るといいかもしれません。
using System.IO; using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; using UnityEngine; /// <summary> /// ビルド時に生成されるBurstDebugInformationフォルダを自動削除するエディタ拡張 /// </summary> public class BurstDebugInformationCleaner : IPostprocessBuildWithReport { /// <summary> /// ビルド後処理の実行順序 /// </summary> public int callbackOrder => 999; /// <summary> /// ビルド後にBurstDebugInformationフォルダを削除 /// </summary> public void OnPostprocessBuild(BuildReport report) { string buildPath = report.summary.outputPath; //ビルドパスが無効な場合はエラー if (string.IsNullOrEmpty(buildPath)) { Debug.LogError("ビルドパスが無効です。BurstDebugInformationフォルダの削除をスキップします。"); return; } //親ディレクトリを検索対象にして、BurstDebugInformationフォルダを検索して削除 DeleteBurstDebugFolders(Path.GetDirectoryName(buildPath)); } /// <summary> /// BurstDebugInformationフォルダを検索して削除 /// </summary> private void DeleteBurstDebugFolders(string rootPath) { try { //ルートディレクトリが存在しない場合はスキップ if (!Directory.Exists(rootPath)) { Debug.LogWarning($"指定されたパスが存在しません: {rootPath}"); return; } //BurstDebugInformationフォルダを検索 string[] burstDebugFolders = Directory.GetDirectories( rootPath, "*_BurstDebugInformation_DoNotShip", SearchOption.TopDirectoryOnly ); if (burstDebugFolders.Length == 0) { Debug.Log($"BurstDebugInformationフォルダは見つかりませんでした。検索パス: {rootPath}"); return; } //見つかったフォルダを削除 foreach (string folder in burstDebugFolders) { try { Directory.Delete(folder, true); Debug.Log($"BurstDebugInformationフォルダを削除しました: {folder}"); } catch (System.Exception ex) { Debug.LogError($"フォルダの削除に失敗しました: {folder}\nエラー: {ex.Message}"); } } Debug.Log($"合計 {burstDebugFolders.Length} 個のBurstDebugInformationフォルダを削除しました。"); } catch (System.Exception ex) { Debug.LogError($"BurstDebugInformationフォルダの検索中にエラーが発生しました: {ex.Message}"); } } }