Second commit
This commit is contained in:
commit
36840f3ad4
999 files changed
+61364
No files matched your search
@@ -0,0 +1,30 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
|
||||
namespace Code.Infrastructure.Utils
|
||||
{
|
||||
public static class AddressablesUtilities
|
||||
{
|
||||
public static async UniTask<bool> CheckLabelExists(string labelName)
|
||||
{
|
||||
if (labelName is null) return false;
|
||||
|
||||
var handle = Addressables.LoadResourceLocationsAsync(labelName);
|
||||
|
||||
await handle.ToUniTask();
|
||||
|
||||
if (handle.Status == AsyncOperationStatus.Succeeded)
|
||||
{
|
||||
if (handle.Result.Count > 0)
|
||||
{
|
||||
Addressables.Release(handle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Addressables.Release(handle);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user