LoginSignup
2
0

More than 3 years have passed since last update.

Addressable Assetsで全てのラベルとエントリーを表示する。(備忘録)

Last updated at Posted at 2019-09-11

Addressable Assetsに登録したファイルが膨大な量になった際、AssetReferenceを属性でフィルタしても限界ありそうだな~と思って、とりあえず全部出力したくなる気がしたのでコード読んでました。

環境

Unity 2019.1.9f1
Addressable Assets 1.1.10

本題

今回はそのままAddressableAssetsWindow.csに書きましたが、別のエディタ拡張クラスを使ったほうが実用的だと思います。

AddressableAssetsWindow.cs
[MenuItem ("Window/Asset Management/Show Entries")]
static void ShowEntries () {
    var window = GetWindow<AddressableAssetsWindow> ();
    if (AddressableAssetSettingsDefaultObject.Settings == null) {
        Debug.LogWarning ("先にSettingsを作成してください。");
        return;
    }
    if (window.m_GroupEditor == null) {
        window.m_GroupEditor = new AddressableAssetsSettingsGroupEditor (window);
    }
    // ラベルテーブルにあるラベルすべて表示
    foreach (var label in window.m_GroupEditor.settings.labelTable.labelNames) {
        Debug.Log (label);
    }
    // すべてのグループと、それに属するエントリーを取得
    foreach (var group in window.m_GroupEditor.settings.groups) {
        Debug.Log (group.Name);
        foreach (var entry in group.entries) {
            Debug.Log (entry.address);
        }
    }
}

AddressableAssetsSettingsGroupEditorが設定のもろもろを持っているので、その中身を見ているだけです。

結果

debuglog.PNG

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0