2025-07-08 10:46:31 +00:00
|
|
|
using System.Linq;
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
using UnityEditor.AddressableAssets;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
public class AddressableManager : Singleton<AddressableManager>
|
|
|
|
{
|
|
|
|
public static bool HasLabel(string addressKey, string label)
|
|
|
|
{
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
var settings = AddressableAssetSettingsDefaultObject.Settings;
|
|
|
|
if (settings == null) return false;
|
|
|
|
|
|
|
|
var entry = settings.groups
|
|
|
|
.SelectMany(g => g.entries)
|
|
|
|
.FirstOrDefault(e => e.address == addressKey);
|
|
|
|
|
|
|
|
if (entry == null) return false;
|
|
|
|
|
|
|
|
return entry.labels.Contains(label);
|
|
|
|
#else
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|