Ejemplo n.º 1
0
        static void ValidateAssetBundle(string bundleName, ref List <string> errList)
        {
            string      path       = Utility.GetStreamingAssetsDirectory();
            string      bundlePath = Path.Combine(path, bundleName);
            AssetBundle bundle     = AssetBundle.LoadFromFile(bundlePath);

            if (bundle != null)
            {
                bundle.Unload(true);
            }
            else
            {
                errList.Add(bundleName);
            }
        }
Ejemplo n.º 2
0
        public static bool ValidateAssetBundles()
        {
            string path = Utility.GetStreamingAssetsDirectory();

            Debug.LogFormat("AssetBundle Path = {0}", path);

            List <string> errBundles = new List <string>();

            ValidateAssetBundle(Utility.GetPlatformName(), ref errBundles);

            string[] bundles = AssetDatabase.GetAllAssetBundleNames();
            float    p       = 0;

            foreach (var bundleName in bundles)
            {
                if (!Application.isBatchMode)
                {
                    EditorUtility.DisplayProgressBar("ValidateAssetBundles", bundleName, p++ *1f / bundles.Length);
                }
                ValidateAssetBundle(bundleName, ref errBundles);
            }

            if (!Application.isBatchMode)
            {
                EditorUtility.ClearProgressBar();
            }

            if (errBundles.Count > 0)
            {
                foreach (var str in errBundles)
                {
                    Debug.LogErrorFormat("{0} has something err", str);
                }
                return(false);
            }

            return(true);
        }