예제 #1
0
        public static bool ClearDepAB(string path)
        {
            var import = AssetImporter.GetAtPath(path);

            if (import && string.IsNullOrEmpty(import.assetBundleName) && ABConfig.IsDepABName(import.assetBundleName))
            {
                import.assetBundleName = null;
                return(true);
            }
            return(false);
        }
예제 #2
0
        public static bool ClearAllDepABName(bool refreshAndSaveAssets)
        {
            var needRefresh = false;

            foreach (var abName in AssetDatabase.GetAllAssetBundleNames())
            {
                if (ABConfig.IsDepABName(abName))
                {
                    foreach (var path in AssetDatabase.GetAssetPathsFromAssetBundle(abName))
                    {
                        needRefresh |= ClearAB(path);
                    }
                    AssetDatabase.RemoveAssetBundleName(abName, true);
                }
            }
            if (needRefresh && refreshAndSaveAssets)
            {
                AssetDatabase.Refresh();
                AssetDatabase.SaveAssets();
            }
            return(true);
        }