.unity3d格式打包与解包

.unity3d格式打包与解包

打包

打包主要用到BuildPipeline.BuildAssetBundle

bt = BuildTarget.StandaloneWindows
string path = EditorUtility.SaveFilePanel("Save Resource", targetDir, saveFileName, "unity3d");
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, options, bt);

解包

解包主要用到WWW

void Start()
{
    StartCoroutine(PreCacheGoodsXmlNodesOld());
}

public static IEnumerator PreCacheGoodsXmlNodesOld()
{
    Object unity3d = Selection.activeObject;
    string url = "";
    WWW www = new WWW(url);
    yield return www;

    AssetBundle assetBundle = null;
    assetBundle = www.assetBundle;
    Object[] objs= assetBundle.LoadAll();
}
发布了72 篇原创文章 · 获赞 4 · 访问量 5万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览