标签:byte reference type .com free decrypt trie ini inf
【AssetBundles】
1、通过加密AssetBundle内的内容,来保护数据。
1 string url = "http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d"; 2 IEnumerator Start () { 3 // Start a download of the encrypted assetbundle 4 WWW www = new WWW.LoadFromCacheOrDownload (url, 1); 5 6 // Wait for download to complete 7 yield return www; 8 9 // Load the TextAsset from the AssetBundle 10 TextAsset textAsset = www.assetBundle.Load("EncryptedData", typeof(TextAsset)); 11 12 // Get the byte data 13 byte[] encryptedData = textAsset.bytes; 14 15 // Decrypt the AssetBundle data 16 byte[] decryptedData = YourDecryptionMethod(encryptedData); 17 18 // Use your byte array. The AssetBundle will be cached 19 }
2、通过加密AssetBundle,来保护数据。
1 string url = "http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d"; 2 IEnumerator Start () { 3 // Start a download of the encrypted assetbundle 4 WWW www = new WWW (url); 5 6 // Wait for download to complete 7 yield return www; 8 9 // Get the byte data 10 byte[] encryptedData = www.bytes; 11 12 // Decrypt the AssetBundle data 13 byte[] decryptedData = YourDecryptionMethod(encryptedData); 14 15 // Create an AssetBundle from the bytes array 16 17 AssetBundleCreateRequest acr = AssetBundle.CreateFromMemory(decryptedData); 18 yield return acr; 19 20 AssetBundle bundle = acr.assetBundle; 21 22 // You can now use your AssetBundle. The AssetBundle is not cached. 23 }
3、一个AssetBundle中加入另一个加密过的AssetBundel。
1 string url = "http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d"; 2 IEnumerator Start () { 3 // Start a download of the encrypted assetbundle 4 WWW www = new WWW.LoadFromCacheOrDownload (url, 1); 5 6 // Wait for download to complete 7 yield return www; 8 9 // Load the TextAsset from the AssetBundle 10 TextAsset textAsset = www.assetBundle.Load("EncryptedData", typeof(TextAsset)); 11 12 // Get the byte data 13 byte[] encryptedData = textAsset.bytes; 14 15 // Decrypt the AssetBundle data 16 byte[] decryptedData = YourDecryptionMethod(encryptedData); 17 18 // Create an AssetBundle from the bytes array 19 AssetBundleCreateRequest acr = AssetBundle.CreateFromMemory(decryptedData); 20 yield return acr; 21 22 AssetBundle bundle = acr.assetBundle; 23 24 // You can now use your AssetBundle. The wrapper AssetBundle is cached 25 }
4、二进制数据必须以.bytes结尾,才能保存进AssetBundle,类型是TextAsset。
1 string url = "http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d"; 2 IEnumerator Start () { 3 // Start a download of the given URL 4 WWW www = WWW.LoadFromCacheOrDownload (url, 1); 5 6 // Wait for download to complete 7 yield return www; 8 9 // Load and retrieve the AssetBundle 10 AssetBundle bundle = www.assetBundle; 11 12 // Load the TextAsset object 13 TextAsset txt = bundle.Load("myBinaryAsText", typeof(TextAsset)) as TextAsset; 14 15 // Retrieve the binary data as an array of bytes 16 byte[] bytes = txt.bytes; 17 }
5、只能加载一个同名AssetBundle。
6、AssetBundle.LoadAssetAsync。
1 using UnityEngine; 2 3 // Note: This example does not check for errors. Please look at the example in the DownloadingAssetBundles section for more information 4 IEnumerator Start () { 5 // Start a download of the given URL 6 WWW www = WWW.LoadFromCacheOrDownload (url, 1); 7 8 // Wait for download to complete 9 yield return www; 10 11 // Load and retrieve the AssetBundle 12 AssetBundle bundle = www.assetBundle; 13 14 // Load the object asynchronously 15 AssetBundleRequest request = bundle.LoadAssetAsync ("myObject", typeof(GameObject)); 16 17 // Wait for completion 18 yield return request; 19 20 // Get the reference to the loaded object 21 GameObject obj = request.asset as GameObject; 22 23 // Unload the AssetBundles compressed contents to conserve memory 24 bundle.Unload(false); 25 26 // Frees the memory from the web stream 27 www.Dispose(); 28 }
7、
标签:byte reference type .com free decrypt trie ini inf
原文地址:http://www.cnblogs.com/tekkaman/p/5988593.html