GetAssetBundleHash() public method

Get the hash for the given AssetBundle.

public GetAssetBundleHash ( string assetBundleName ) : Hash128
assetBundleName string Name of the asset bundle.
return Hash128
コード例 #1
0
        public static AssetBundleManifest Create(UnityEngine.AssetBundleManifest manifest)
        {
            AssetBundleManifest result = new AssetBundleManifest()
            {
                Version = DateTime.Now.ToString("yyyyMMddHHmmss")
            };

            if (manifest == null)
            {
                return(result);
            }

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

            assetbundleNames.AddRange(manifest.GetAllAssetBundles());
            foreach (var name in assetbundleNames)
            {
                AssetBundleInfo info = new AssetBundleInfo()
                {
                    AssetBundleName = name,
                    Hash128         = manifest.GetAssetBundleHash(name).ToString()
                };
                info.AssetPaths.AddRange(AssetDatabase.GetAssetPathsFromAssetBundle(name));
                var dependencies = manifest.GetAllDependencies(name);
                foreach (var depName in dependencies)
                {
                    info.Dependencies.Add(assetbundleNames.IndexOf(depName));
                }
                result.Infos.Add(info);
            }
            return(result);
        }
コード例 #2
0
 static public int GetAssetBundleHash(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         var ret = self.GetAssetBundleHash(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #3
0
    IEnumerator Start()
    {
        //manifestをロード
        using (WWW www = new WWW (path + manifestName)) {
            yield return www;
            if (!string.IsNullOrEmpty (www.error)) {
                Debug.Log (www.error);
                yield break;
            }

            manifest = (AssetBundleManifest)www.assetBundle.LoadAsset ("AssetBundleManifest");
            yield return null;
            www.assetBundle.Unload (false);
        }

        //sceneをロード
        using (WWW www = WWW.LoadFromCacheOrDownload (path + bundleName, manifest.GetAssetBundleHash (bundleName))) {
            yield return www;
            if (!string.IsNullOrEmpty (www.error)) {
                Debug.Log (www.error);
                yield break;
            }

            Application.LoadLevel (sceneName);
            yield return null;

            www.assetBundle.Unload (false);
        }
    }
コード例 #4
0
        public static IEnumerator LoadAssetBundle(string Fdirctory, string FassetBundleName)
        {
            string[]      dps  = assetBundleManifest.GetAllDependencies(FassetBundleName);
            AssetBundle[] temp = new AssetBundle[dps.Length];
            for (int i = 0; i < dps.Length; i++)
            {
                WWW www = WWW.LoadFromCacheOrDownload(dps[i], assetBundleManifest.GetAssetBundleHash(dps[i]));
                yield return(www);

                temp[i] = www.assetBundle;
            }

            WWW tar = WWW.LoadFromCacheOrDownload(Fdirctory + FassetBundleName, assetBundleManifest.GetAssetBundleHash(FassetBundleName));

            yield return(tar);

            AssetBundle t = tar.assetBundle;
        }
コード例 #5
0
 static public int GetAssetBundleHash(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         var ret = self.GetAssetBundleHash(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public void AddUnityManifest(UnityEngine.AssetBundleManifest manifest)
 {
     if (manifest == null)
     {
         return;
     }
     string[] inOriginList = manifest.GetAllAssetBundles();
     foreach (var origin in inOriginList)
     {
         allAssetBundles.Add(origin);
         allDependencies.Add(origin, manifest.GetAllDependencies(origin));
         allHash.Add(origin, manifest.GetAssetBundleHash(origin));
     }
 }
コード例 #7
0
ファイル: Loader.cs プロジェクト: lin5/MMDARPG
        /// <summary>
        /// 加载资源包
        /// </summary>
        /// <param name="dirctory"></param>
        /// <param name="assetBundleName"></param>
        /// <returns></returns>
        public static IEnumerator LoadAssetBundle(string dirctory, string assetBundleName)
        {
            ///如果assetBundleManifest为空,结束加载。
            if (assetBundleManifest == null)
            {
                yield break;
            }

            string[]      dps  = assetBundleManifest.GetAllDependencies(assetBundleName);
            AssetBundle[] temp = new AssetBundle[dps.Length];
            for (int i = 0; i < dps.Length; i++)
            {
                WWW www = WWW.LoadFromCacheOrDownload(dps[i], assetBundleManifest.GetAssetBundleHash(dps[i]));
                yield return(www);

                temp[i] = www.assetBundle;
            }

            WWW tar = WWW.LoadFromCacheOrDownload(dirctory + assetBundleName, assetBundleManifest.GetAssetBundleHash(assetBundleName));

            yield return(tar);

            AssetBundle t = tar.assetBundle;
        }
コード例 #8
0
 static int GetAssetBundleHash(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AssetBundleManifest obj = (UnityEngine.AssetBundleManifest)ToLua.CheckObject <UnityEngine.AssetBundleManifest>(L, 1);
         string arg0           = ToLua.CheckString(L, 2);
         UnityEngine.Hash128 o = obj.GetAssetBundleHash(arg0);
         ToLua.PushValue(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #9
0
        public static IEnumerator LoadAssetBundle()
        {
            string url  = Application.streamingAssetsPath + "/AssetBundles/";
            string path = CFG.WWWstreamingAssetsPathPrefix + url + "AssetBundles";
            WWW    nwww = WWW.LoadFromCacheOrDownload(path, 0);

            yield return(nwww);

            if (string.IsNullOrEmpty(nwww.error))
            {
                AssetBundle         mab  = nwww.assetBundle;
                UnityEngine.Object  g0   = mab.LoadAsset("AssetBundleManifest");
                AssetBundleManifest main = g0 as AssetBundleManifest;
                mab.Unload(false);

                string[]      dps  = main.GetAllDependencies("Commen");
                AssetBundle[] temp = new AssetBundle[dps.Length];
                foreach (var item in dps)
                {
                    WWW durkl = WWW.LoadFromCacheOrDownload(item, main.GetAssetBundleHash(item));
                    yield return(durkl);

                    temp[0] = durkl.assetBundle;
                }

                WWW tar = WWW.LoadFromCacheOrDownload(CFG.WWWstreamingAssetsPathPrefix + url + "Commen", main.GetAssetBundleHash("Commen"), 0);
                yield return(tar);

                AssetBundle t   = tar.assetBundle;
                Sprite      _tt = t.LoadAsset <Sprite>("20");
                GameObject  g   = new GameObject();
                var         r   = g.AddComponent <SpriteRenderer>();
                r.sprite = _tt;
            }
            else
            {
#if UNITY_EDITOR || Development
                Debuger.Log(nwww.error);
#endif
            }
        }
コード例 #10
0
        static AssetBundleManifest OutputResult(string resultFile, float useTime, UnityEngine.AssetBundleManifest manifest)
        {
            if (manifest == null)
            {
                return(null);
            }

            AssetBundleManifest result = new AssetBundleManifest();

            result.buildTime = useTime;
            List <AssetBundleManifest.AssetBundleBuild> bundles = new List <AssetBundleManifest.AssetBundleBuild>();

            foreach (var name in manifest.GetAllAssetBundles())
            {
                AssetBundleManifest.AssetBundleBuild bundle = new AssetBundleManifest.AssetBundleBuild();
                bundle.assetBundleName = name;
                bundle.dependency      = manifest.GetDirectDependencies(name);
                bundle.hash            = manifest.GetAssetBundleHash(name).ToString();
                bundles.Add(bundle);
            }
            result.builds = bundles.ToArray();
            File.WriteAllText(resultFile, JsonUtility.ToJson(result, true));
            return(result);
        }
コード例 #11
0
	private string[] GetAssetbundlesNeedsUpdate(AssetBundleManifest servermanifest, AssetBundleManifest localmanifest)
    {
        List<string> result = new List<string>();
        var allassets = servermanifest.GetAllAssetBundles();
        for (int i = 0; i < allassets.Length; i++)
        {
			Debug.Log("compare hash for bundle:" + allassets[i]);
            if (localmanifest.GetAssetBundleHash(allassets[i]).ToString() != servermanifest.GetAssetBundleHash(allassets[i]).ToString())
                result.Add(allassets[i]);
        }

        return result.ToArray();
    }
コード例 #12
0
ファイル: input.cs プロジェクト: fizz-yamashita/python_tools
	// =====ここからメソッド群=====
	
	// 作成したアセットバンドル情報を、ソートしたディクショナリー形式にして返す
	static private SortedDictionary<string, string> CreateAssetbundleSortedDictionary(AssetBundleManifest assetBundleManifest) {
		string[] allAssetBundles = assetBundleManifest.GetAllAssetBundles();
		SortedDictionary<string, string> forSortList = new SortedDictionary<string, string>();
		for( int i = 0; i < allAssetBundles.Length ; i++ ) {
			string hash = assetBundleManifest.GetAssetBundleHash( allAssetBundles[i] ).ToString();

			forSortList.Add(allAssetBundles[i], hash);
		}

		// 結果出力
		Debug.Log("=====SortedDictionary:OutputStart=====");
		foreach(var data in forSortList) {
			Debug.Log("key : " + data.Key + "/" + "Value : " + data.Value);
		}
		Debug.Log("=====SortedDictionary:OutputEnd=====");

		return forSortList;
	}