1. 그룹 이름으로 알아내기
using System.Collections;
using System.Collections.Generic;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
public class QuestManager
{
private const string GroupName = "Quest";
public void Init()
{
// Addressable Asset Settings를 가져오기
AddressableAssetSettings settings = AddressableAssetSettingsDefaultObject.Settings;
// 그룹 이름으로 그룹 찾기
AddressableAssetGroup targetGroup = settings.FindGroup(GroupName);
if(targetGroup != null)
{
Debug.Log("현재 그룹 내 개수 : " + targetGroup.entries.Count);
}
else
{
Debug.LogError("해당 이름의 그룹이 존재하지 않습니다.");
}
}
}
- AddressableAssetSettings는 이 창을 말하는 것

2. 라벨 이름으로 알아내기
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
public class LabelAssetCounter : MonoBehaviour
{
public string labelName; // 조회할 라벨의 이름
private void Start()
{
// Addressable Asset Settings를 가져옵니다.
AddressableAssetSettings settings = AddressableAssetSettingsDefaultObject.Settings;
// 라벨 이름으로 라벨을 찾습니다.
AddressableAssetGroup[] labeledGroups = settings.FindAssetGroupsByLabel(labelName);
if (labeledGroups.Length > 0)
{
int totalAssetCount = 0;
foreach (AddressableAssetGroup group in labeledGroups)
{
// 라벨에 속한 모든 Asset의 개수를 가져와서 누적합니다.
totalAssetCount += group.entries.Count;
}
Debug.Log($"Label '{labelName}' contains {totalAssetCount} assets in total.");
}
else
{
Debug.LogError($"Label '{labelName}' not found or no assets associated with the label!");
}
}
}
좋은 글 감사합니다. 자주 방문할게요 :)