Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

The Remote Download

Discussion in 'Addressables' started by gugua, Dec 28, 2019.

  1. gugua

    gugua

    Joined:
    Jan 11, 2013
    Posts:
    32
    Hello:
    I use the Addressables to Remote Download spriteAtlas.
    In the "Simulate Groups" error:

    ResourceManagerException encountered in operation InvalidHandle: Unable to load asset Assets/Resources_moved/Art/Atlas/MainCards.spMainCards from simulated bundle http://156.233.64.47/slots/Android/77739cdc7ca2645a40b743cd298142fa_assets_all.bundle.
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:<.ctor>b__27_0(AsyncOperationHandle)
    DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.AsyncOperations.GroupOperation:OnOperationCompleted(AsyncOperationHandle)
    DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ResourceProviders.Simulation.InternalOp:<Start>b__4_0(VBAsyncOperation`1)
    DelegateList`1:Invoke(VBAsyncOperation`1) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ResourceManager:Update(Single)

    My Code:
    Code (CSharp):
    1. public class Test2 : MonoBehaviour
    2. {
    3.     public SpriteRenderer ss;
    4.     //public SpriteAtlas sp;
    5.  
    6.     public AssetReferenceAtlas spriteAtlasReference;
    7.     // Start is called before the first frame update
    8.     void Start()
    9.     {
    10.  
    11.         //Addressables.LoadAssetAsync("MainCards").Completed += OnLoadDone;
    12.  
    13.         spriteAtlasReference.LoadAssetAsync().Completed += AtlasDone;
    14.  
    15.         //ss.sprite = sp.GetSprite("ui_spcard_01");
    16.     }
    17.     void AtlasDone(AsyncOperationHandle<SpriteAtlas> op)
    18.     {
    19.         if (op.Result == null)
    20.         {
    21.             Debug.LogError("no atlases here.");
    22.             return;
    23.         }
    24.         //sp = obj.Result;
    25.         //spritesToChange[2].sprite = op.Result.GetSprite("u3");
    26.  
    27.         //sp = obj.Result;
    28.         ss.sprite = op.Result.GetSprite("ui_spcard_01");
    29.     }
    30.     /*
    31.     private void OnLoadDone(UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle<SpriteAtlas> obj)
    32.     {
    33.         // In a production environment, you should add exception handling to catch scenarios such as a null result.
    34.         //myGameObject = obj.Result;
    35.         sp = obj.Result;
    36.         ss.sprite = sp.GetSprite("ui_spcard_01");
    37.     }*/
    38.     // Update is called once per frame
    39.  
    40. }
    41. [Serializable]
    42. public class AssetReferenceAtlas : AssetReferenceT<SpriteAtlas>
    43. {
    44.     public AssetReferenceAtlas(string guid) : base(guid) { }
    45. }

    and My Setting:
     

    Attached Files:

    • 1.png
      1.png
      File size:
      12.1 KB
      Views:
      383
    • 2.png
      2.png
      File size:
      41.2 KB
      Views:
      384
    • 3.png
      3.png
      File size:
      35.9 KB
      Views:
      388
  2. gugua

    gugua

    Joined:
    Jan 11, 2013
    Posts:
    32
    I found the problem because I used unity 2018.
     

    Attached Files:

  3. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
    Hey @gugua, I can send this post over for you to see if our team can have a look!