예제 #1
0
        public T LoadAsset <T>(string _module, string _res) where T : UnityEngine.Object
        {
            T _t = null;

            _module = _module.ToLower();
            _res    = _res.ToLower();
#if UNITY_EDITOR
            if (!string.IsNullOrEmpty(_module))
            {
                _t = EditorLoad <T>(_module, _res);
            }
#endif
            if (_t == null)
            {
                AssetModuleConfig _amc = GetAssetModuleConfigByModule(_module, _res);
                if (_amc == null)
                {
                    return(null);
                }
                _t = LoadAssetBundle <T>(_amc.GetBundleName(_res), _amc.GetResourceName(_res));
            }
            if (_t == null)
            {
                Utility.LogError("模块", _module, "中的资源", _res, "加载失败!");
            }
            return(_t);
        }
예제 #2
0
        public void UnloadAsset(string _module, string _res)
        {
            AssetModuleConfig _amc = GetAssetModuleConfigByModule(_module, _res);

            if (_amc == null)
            {
                return;
            }
            UnloadAssetBundle(_amc.GetBundleName(_res));
        }