feat: support asset bundle

This commit is contained in:
2026-05-15 16:45:58 +08:00
parent 8a0ad07a2a
commit 2cec127e31
27 changed files with 390 additions and 8 deletions
@@ -0,0 +1,28 @@
using System;
using UnityEngine;
namespace OCES
{
public class AssetBundleAssetProvider : IAssetProvider
{
readonly AssetBundle m_assetBundle;
public AssetBundleAssetProvider(string bundleFilePath)
{
this.m_assetBundle = AssetBundle.LoadFromFile(bundleFilePath);
if (this.m_assetBundle is null)
{
Debug.LogError($"[OCES] 无法加载: {bundleFilePath}");
}
}
public T Load<T>(string path) where T : UnityEngine.Object
{
return this.m_assetBundle.LoadAsset<T>(path);
}
public ResourceRequest LoadAsync<T>(string path) where T : UnityEngine.Object
{
return this.m_assetBundle.LoadAssetAsync<T>(path);
}
}
}