31 lines
721 B
C#
31 lines
721 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using BITKit.Mod;
|
||
|
using Cysharp.Threading.Tasks;
|
||
|
using UnityEngine;
|
||
|
using YooAsset;
|
||
|
using Object = UnityEngine.Object;
|
||
|
|
||
|
namespace BITKit.IO
|
||
|
{
|
||
|
public class YooAssetModHelper : MonoBehaviour
|
||
|
{
|
||
|
private void OnEnable()
|
||
|
{
|
||
|
ModService.LoadAssetAsyncFactory += LoadAsset;
|
||
|
}
|
||
|
private void OnDisable()
|
||
|
{
|
||
|
ModService.LoadAssetAsyncFactory -= LoadAsset;
|
||
|
}
|
||
|
|
||
|
private static async UniTask<object> LoadAsset(string arg)
|
||
|
{
|
||
|
var handle = YooAssets.LoadAssetAsync(arg);
|
||
|
await handle;
|
||
|
return handle.AssetObject;
|
||
|
}
|
||
|
}
|
||
|
}
|