名字为111的AB包中 已经有打包的材质 名字为 test
...
using UnityEditor;
...
public AssetBundle ab_material;
public Material m;
...
/// <summary>
/// 从 111 ab包中 获取 名字为test的材质
/// </summary>
private void testGetMaterial()
{
string str_material = Application.persistentDataPath+"/111";//注意AB包的 打包平台是否正确
ab_material = AssetBundle.LoadFromFile(str_material);//加载本地AB包内容
if (ab_material != null)
{
m = ab_material.LoadAsset<Material>("test");
}//
}//
...