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

24 lines
822 B
C#
Raw Normal View History

2023-06-08 14:09:50 +08:00
using BITFALL;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit
{
public static class ItemExtensions
{
public static AssetableItem GetAssetable(this IBasicItem self)
{
2023-11-15 23:54:54 +08:00
var task = YooAsset.YooAssets.LoadAssetAsync<AssetableItem>(self.AddressablePath);
task.WaitForAsyncComplete();
return task.AssetObject.As<AssetableItem>();
//return Addressables.LoadAssetAsync<AssetableItem>(self.AddressablePath).WaitForCompletion();
2023-11-30 00:23:23 +08:00
}
public static AssetableItem GetAssetable(string address)
{
var task = YooAsset.YooAssets.LoadAssetAsync<AssetableItem>(address);
task.WaitForAsyncComplete();
return task.AssetObject.As<AssetableItem>();
2023-06-08 14:09:50 +08:00
}
}
}