Unity3D 保护资源管理文件的 AssetBundle 包加密!
Posted on 2013 年 01 月 24 日 by U3d / Unity3D 脚本/插件/被围观 447 次
保护资源管理文件的相关内容
Unity 允许用户使用 AssetBundle.CreateFromMemory 从一个 byte[]数组中建立一个
AssetBundle 的对象。在运行传输解密时,可以用这种加密方法来提高安全性和保护用户
建立的资源管理中的内容。
string url =
"http://www.mywebsite.com/mygame/assetbundles/assetbundle1.unity3d";
IEnumerator Start () { // Start a download of the given URL WWW www =
new WWW (url);
// Wait for download to complete
yield return www;
// Get the byte data
byte[] encryptedData = www.bytes;
// Load the TextAsset object
byte[] decryptedData = YourDecryptionMethod(encryptedData);
// Create an AssetBundle from the bytes array
AssetBundle bundle = AssetBundle.CreateFromMemory(decryptedData);
评论0