コガネブログ

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

【Unity】Addressable Asset System で Bundle Naming を Use Hash of Filename にした時に生成されるハッシュを取得する方法

概要

[MenuItem( "Tools/Hoge" )]
private static void Hoge()
{
    var filename = "【アセットバンドルのファイル名】";
    var hash     = HashingMethods.Calculate( filename );

    Debug.Log( hash );
}
  • HashingMethods.Calculate を使用する
  • アセットバンドルのファイル名は下記のようなもの
    • 【グループ名の lowercase】_assets_all.bundle
    • 【グループ名の lowercase】_scenes_all.bundle
  • BuildUtility.cs の 52 行目あたり