UnityEditor上でAddressableのAssetを同期的に読む

Testとかのために同期的にAddressableからAssetを読みたい時用。

public static class EditorAddressables
{
    public static AddressableAssetGroup[] GetGroups()
    {
        var settings = UnityEditor.AddressableAssets.AddressableAssetSettingsDefaultObject.Settings;
        var groups = settings.groups;
        return groups.ToArray();
    }

    public static T LoadAssetAsync<T>(string address) where T : UnityEngine.Object
    {
        var entry = GetGroups().SelectMany(x => x.entries)
            .Single(x => x.address == address);
        return (T) entry.MainAsset;
    }
}