unity assetbundle打包

2020-03-19 10:10:53 浏览数 (1)

fbx元素提取

代码语言:javascript复制
[MenuItem("Avatar/Generate AllData",false,0)]
private static void GenerateAllData()
{
    UnityEngine.Object[] res = Selection.GetFiltered<UnityEngine.Object>(SelectionMode.DeepAssets);
    UnityEngine.Object obj = res.Where(o=>o is DefaultAsset).FirstOrDefault();
    string path = (AssetDatabase.GetAssetPath(obj??res.FirstOrDefault()));
    string newPath = Temp_PATH   path.Substring(path.LastIndexOf("/") 1) "\";
    if (!Directory.Exists(newPath)) Directory.CreateDirectory(newPath);
    foreach (UnityEngine.Object it in res)
    {
        if(it is DefaultAsset)  continue;
        UnityEngine.Object[] o = AssetDatabase.LoadAllAssetsAtPath(AssetDatabase.GetAssetPath(it));
        foreach (UnityEngine.Object i in o)
        {
            if (i.name.Contains("__preview__")) continue;
            else if (i is AnimationClip)
                AssetDatabase.CreateAsset(Instantiate(i), newPath i.name ".anim");
            else if(i is Ma

0 人点赞