BITFALL/Assets/Artists/Scripts/Item/ItemExtensions.cs

24 lines
822 B
C#

using BITFALL;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit
{
public static class ItemExtensions
{
public static AssetableItem GetAssetable(this IBasicItem self)
{
var task = YooAsset.YooAssets.LoadAssetAsync<AssetableItem>(self.AddressablePath);
task.WaitForAsyncComplete();
return task.AssetObject.As<AssetableItem>();
//return Addressables.LoadAssetAsync<AssetableItem>(self.AddressablePath).WaitForCompletion();
}
public static AssetableItem GetAssetable(string address)
{
var task = YooAsset.YooAssets.LoadAssetAsync<AssetableItem>(address);
task.WaitForAsyncComplete();
return task.AssetObject.As<AssetableItem>();
}
}
}