using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using Object = UnityEngine.Object;
public class AssetBundleMgr : MonoBehaviour
{
/// <summary>
/// AB 包存放路径
/// </summary>
private static readonly string AB_DIRECTORY = Application.streamingAssetsPath + "/";
/// <summary>
/// 主包名
/// </summary>
private static readonly string MAIN_AB_NAME = "StandaloneWindows";
/// <summary>
/// 主包
/// </summary>
private AssetBundle mainAB = null;
/// <summary>
/// 依赖包获取用的配置文件
/// </summary>
private AssetBundleManifest manifest = null;
/// <summary>
/// 存储加载过的 AB 包,避免重复加载报错
/// </summary>
private Dictionary<string, AssetBundle> abDic = new Dictionary<string, AssetBundle>();
public static AssetBundleMgr Instance {
get; private set; }
protected virtual void Awake() {
if (Instance == null) {
Instance = this;
DontDestroyOnLoad(gameObject)
2023-06-08 Unity AssetBundle2——AB包资源管理器AssetBundleMgr
最新推荐文章于 2025-02-20 15:16:06 发布
该代码实现了一个用于管理Unity3DAssetBundle的类AssetBundleMgr,它负责同步和异步加载AB包,处理依赖关系,并提供资源的加载和卸载功能。AssetBundleMgr使用静态单例模式,确保游戏运行期间只有一个实例存在。

最低0.47元/天 解锁文章
324

被折叠的 条评论
为什么被折叠?



