unity AssetBundle 加载资源 笔记
来源:互联网 发布:户外广告投放数据 编辑:程序博客网 时间:2024/05/18 20:12
Android:
string path = Application.dataPath + "/assets/lua/lua.unity3d";
AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/Android/Android");
AssetBundle assetbundle = AssetBundle.LoadFromFile(path);
Sprite sprite = assetbundle.LoadAsset<Sprite>("tupian");
spriteRenderer.sprite = sprite;
IOS:
AssetBundle assetbundle = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/lua/lua.unity3d");
Sprite sprite = assetbundle.LoadAsset<Sprite>("tupian");
spriteRenderer.sprite = sprite;
AssetBundle android = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "Android/Android");
AssetBundleManifest main = (AssetBundleManifest)android.LoadAsset("AssetBundleManifest");
List<string> list = new List<string>(main.GetAllAssetBundles());
Dictionary<string,AssetBundle> BundleMap = new Dictionary<string,AssetBundle>();
for( int i = 0 ; i < list.Count ; i++ )
{
string[] depends = main.GetAllDependencies(list[i]);
AssetBundle[] dependsAssetbundle = new AssetBundle[depends.Length];
//先加载依赖关系
for( int index = 0 ; index < depends.Length ; index++ )
{
dependsAssetbundle[index] = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/Android/" + depends[index]);
BundleMap.Add(depends[index],dependsAssetbundle[index]);
}
AssetBundle assetbundle = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/Android/" + list[i]);
BundleMap.Add(list[i],assetbundle);
}
TextAsset sprite = assetbundle.LoadAsset<TextAsset>("Require.lua.bytes");
string path = Application.dataPath + "/assets/lua/lua.unity3d";
AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/Android/Android");
AssetBundle assetbundle = AssetBundle.LoadFromFile(path);
Sprite sprite = assetbundle.LoadAsset<Sprite>("tupian");
spriteRenderer.sprite = sprite;
IOS:
AssetBundle assetbundle = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/lua/lua.unity3d");
Sprite sprite = assetbundle.LoadAsset<Sprite>("tupian");
spriteRenderer.sprite = sprite;
AssetBundle android = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "Android/Android");
AssetBundleManifest main = (AssetBundleManifest)android.LoadAsset("AssetBundleManifest");
List<string> list = new List<string>(main.GetAllAssetBundles());
Dictionary<string,AssetBundle> BundleMap = new Dictionary<string,AssetBundle>();
for( int i = 0 ; i < list.Count ; i++ )
{
string[] depends = main.GetAllDependencies(list[i]);
AssetBundle[] dependsAssetbundle = new AssetBundle[depends.Length];
//先加载依赖关系
for( int index = 0 ; index < depends.Length ; index++ )
{
dependsAssetbundle[index] = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/Android/" + depends[index]);
BundleMap.Add(depends[index],dependsAssetbundle[index]);
}
AssetBundle assetbundle = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/Android/" + list[i]);
BundleMap.Add(list[i],assetbundle);
}
TextAsset sprite = assetbundle.LoadAsset<TextAsset>("Require.lua.bytes");
0 0
- unity AssetBundle 加载资源 笔记
- Unity的动态加载AssetBundle资源笔记。
- Unity 资源打包Assetbundle
- Unity 资源打包Assetbundle
- Unity 资源打包Assetbundle
- Unity资源打包Assetbundle
- C# Unity用AssetBundle加载本地资源 (1)
- [unity]AssetBundle加载
- Unity AssetBundle依赖加载
- Unity AssetBundle 加载
- unity的assetbundle加载
- Unity资源打包之Assetbundle
- Unity之资源打包Assetbundle
- Unity资源解决方案之AssetBundle
- Unity资源打包之Assetbundle
- unity-AssetBundle资源冗余检测
- AssetBundle-----资源加载(读取assetbundle)
- Unity资源处理机制(Assets/WWW/AssetBundle/...)读取和加载资源方式详解
- gtk-3.0学习笔记1-环境配置
- 读书有感
- 目标跟踪算法的展望
- Android 权限集合
- Vue2.0 新手填坑攻略 — 从环境搭建到发布
- unity AssetBundle 加载资源 笔记
- github学习
- java同步机制:synchronized
- 数字图像处理基本知识
- MyBatis中like查询写法
- 页面日期格式转换(以jsp为例)
- TSQL 聚合函数忽略NULL值
- android 屏幕常亮
- PHP通用字符串截取函数