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

24 lines
828 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
{
2024-04-06 16:33:57 +08:00
public static ScriptableItem GetAssetable(this IBasicItem self)
2023-06-08 14:09:50 +08:00
{
2024-04-06 16:33:57 +08:00
var task = YooAsset.YooAssets.LoadAssetAsync<ScriptableItem>(self.AddressablePath);
2023-11-15 23:54:54 +08:00
task.WaitForAsyncComplete();
2024-04-06 16:33:57 +08:00
return task.AssetObject.As<ScriptableItem>();
2023-11-15 23:54:54 +08:00
//return Addressables.LoadAssetAsync<AssetableItem>(self.AddressablePath).WaitForCompletion();
2023-11-30 00:23:23 +08:00
}
2024-04-06 16:33:57 +08:00
public static ScriptableItem GetAssetable(string address)
2023-11-30 00:23:23 +08:00
{
2024-04-06 16:33:57 +08:00
var task = YooAsset.YooAssets.LoadAssetAsync<ScriptableItem>(address);
2023-11-30 00:23:23 +08:00
task.WaitForAsyncComplete();
2024-04-06 16:33:57 +08:00
return task.AssetObject.As<ScriptableItem>();
2023-06-08 14:09:50 +08:00
}
}
}