1
This commit is contained in:
30
Src/Unity/Scripts/Assets/YooAssetModHelper.cs
Normal file
30
Src/Unity/Scripts/Assets/YooAssetModHelper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user