Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Addressable.CN: Data Stream Processor

Discussion in 'Getting Started' started by nam-hd23, Mar 21, 2023.

  1. nam-hd23

    nam-hd23

    Joined:
    Aug 3, 2013
    Posts:
    5
    Hi,
    I'm finding a way to encrypt addressable to protect my assets. I found this thread https://forum.unity.com/threads/addressables-feature-request-basic-encryption.532604/ and check Addressables.CN package. I try import to my project but have issue:
    1. When I choose Data Stream Processor = none: Editor & Android build work fine
    2. When I choose Data Stream Processor = other(AES, GZip...): Editor work fine, Android build has InvalidCastException: Specified cast is not valid
    My code verry simple
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using UnityEngine.AddressableAssets;
    4. using UnityEngine.AddressableAssets.ResourceLocators;
    5. using UnityEngine.ResourceManagement.AsyncOperations;
    6.  
    7. public class Loading : MonoBehaviour
    8. {
    9.     void Awake()
    10.     {
    11.         Addressables.InitializeAsync().Completed += OnComplete;
    12.     }
    13.  
    14.     private void OnComplete(AsyncOperationHandle<IResourceLocator> obj)
    15.     {
    16.         Addressables.LoadAssetAsync<Sprite>("background").Completed += (o) =>
    17.         {
    18.             GetComponent<SpriteRenderer>().sprite = o.Result;
    19.         };
    20.     }
    21. }
    22.  
    Please help me!
     
    Minh1709 likes this.