コード例 #1
0
        private static void ProcessAssetBundleRes(ResDatas table)
        {
            AssetDataGroup group = null;

            AssetDatabase.RemoveUnusedAssetBundleNames();

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

                    var assets = AssetDatabase.GetAssetPathsFromAssetBundle(abName);
                    foreach (var cell in assets)
                    {
                        @group.AddAssetData(cell.EndsWith(".unity")
                            ? new AssetData(AssetPath2Name(cell), ResType.ABScene, abIndex, abName)
                            : new AssetData(AssetPath2Name(cell), ResType.ABAsset, abIndex, abName));
                    }
                }
            }
        }
コード例 #2
0
        public int AddAssetBundleName(string name, string[] depends, out AssetDataGroup group)
        {
            group = null;

            if (string.IsNullOrEmpty(name))
            {
                return(-1);
            }

            var key = GetKeyFromABName(name);

            if (key == null)
            {
                return(-1);
            }

            group = GetAssetDataGroup(key);

            if (group == null)
            {
                group = new AssetDataGroup(key);
                Log.I("#Create Config Group:" + key);
                mAllAssetDataGroup.Add(group);
            }

            return(group.AddAssetBundleName(name, depends));
        }