コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】Addressables でローカルカタログを圧縮する場合にビルドログがアプリに含まれないようにする方法

検証環境

  • Addressables 1.16.19

概要

  • Addressables でローカルカタログを圧縮する設定を有効化して
    アセットバンドルをビルドするようにしたところ、
    「buildlogtep.json」というビルドログのファイルが
    アプリビルド時にアプリに含まれるようになってしまった
  • AddressablesPlayerBuildProcessor.cs で該当ファイルが
    StreamingAssets フォルダにコピーされるので
    そこで「buildlogtep.json」を削除すればアプリに含まれなくなる

AddressablesPlayerBuildProcessor.cs

49 行目以降

internal static void CopyTemporaryPlayerBuildData()
{
    if (Directory.Exists(Addressables.BuildPath))
    {
        Debug.Log(string.Format(
            "Copying Addressables data from {0} to {1}.  These copies will be deleted at the end of the build.",
            Addressables.BuildPath, Addressables.PlayerBuildDataPath));
        
        // ここで「buildlogtep.json」を削除
        var buildLogPath = Addressables.BuildPath + "/buildlogtep.json";
        if ( File.Exists( buildLogPath ) )
        {
            File.Delete( buildLogPath );
        }
        
        DirectoryUtility.DirectoryCopy(Addressables.BuildPath, Addressables.PlayerBuildDataPath, true);
    }
}