private static void ProcessAssetBundleRes(AssetDataTable table)
        {
            int abIndex = table.AddAssetBundleName(ProjectPathConfigTemp.ABMANIFEST_AB_NAME);

            table.AddAssetData(new AssetData(ProjectPathConfigTemp.ABMANIFEST_ASSET_NAME, eResType.kABAsset, abIndex));

            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                for (int i = 0; i < abNames.Length; ++i)
                {
                    Log.i("AB Name:" + abNames[i]);
                    abIndex = table.AddAssetBundleName(abNames[i]);
                    string[] assets = AssetDatabase.GetAssetPathsFromAssetBundle(abNames[i]);
                    foreach (var cell in assets)
                    {
                        if (cell.EndsWith(".unity"))
                        {
                            table.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABScene, abIndex));
                        }
                        else
                        {
                            table.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABAsset, abIndex));
                        }
                    }
                }
            }

            table.Dump();
        }
Пример #2
0
        private static void ProcessAssetBundleRes(AssetDataTable table)
        {
            AssetDataGroup group = null;

            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                for (int i = 0; i < abNames.Length; ++i)
                {
                    string[] depends = AssetDatabase.GetAssetBundleDependencies(abNames[i], false);
                    var      abIndex = table.AddAssetBundleName(abNames[i], depends, out group);
                    if (abIndex < 0)
                    {
                        continue;
                    }

                    string[] assets = AssetDatabase.GetAssetPathsFromAssetBundle(abNames[i]);
                    foreach (var cell in assets)
                    {
                        if (cell.EndsWith(".unity"))
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), ResType.ABScene, abIndex, abNames[i]));
                        }
                        else
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), ResType.ABAsset, abIndex, abNames[i]));
                        }
                    }
                }
            }

            table.Dump();
        }
        private static void ProcessAssetBundleRes(AssetDataTable table)
        {
            AssetDataPackage group = null;

            int abIndex = table.AddAssetBundleName(ProjectPathConfigTemp.ABMANIFEST_AB_NAME, null, out group);

            if (abIndex > 0)
            {
                group.AddAssetData(new AssetData(ProjectPathConfigTemp.ABMANIFEST_ASSET_NAME, eResType.kABAsset, abIndex));
            }

            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                for (int i = 0; i < abNames.Length; ++i)
                {
                    string[] depends = AssetDatabase.GetAssetBundleDependencies(abNames[i], false);
                    abIndex = table.AddAssetBundleName(abNames[i], depends, out group);
                    if (abIndex < 0)
                    {
                        continue;
                    }

                    string[] assets = AssetDatabase.GetAssetPathsFromAssetBundle(abNames[i]);
                    foreach (var cell in assets)
                    {
                        if (cell.EndsWith(".unity"))
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABScene, abIndex));
                        }
                        else
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABAsset, abIndex));
                        }
                    }
                }
            }

            table.Dump();
        }