본문 바로가기

카테고리 없음

[Unity] AssetBundle 보안 처리하기

  1. 일단 어셋 번들을 만들고 만든 파일들을 암호화 합니다.
  2. 암호화된 파일을 처음 받을 때 다운로드 받습니다.
  3. 다운로드 받은 파일을 복호화 함니다.
  4. 복호화 된 byte 배열을 CreateFromMemory() 함수를 사용해서 메모리에 올리고 사용하시면 됩니다.
// Start a download of the encrypted assetbundle
WWW www = new WWW (url);

// Wait for download to complete  
yield return www;

// Get the byte data  
byte[] encryptedData = [www.bytes](http://www.bytes);

// Decrypt the AssetBundle data  
byte[] decryptedData = 복호화함수(encryptedData);

// Create an AssetBundle from the bytes array  
AssetBundleCreateRequest acr = AssetBundle.CreateFromMemory(decryptedData);

while (!acr.isDone)  
{  
yield return acr;  
}

AssetBundle bundle = acr.assetBundle;
반응형