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
  3. Dismiss Notice

Question How to abort DownloadDependenciesAsync?

Discussion in 'Addressables' started by Peter77, Dec 1, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    Unity 2019.4.20f1, Addressables 1.19.9

    How can I abort a running
    Addressables.DownloadDependenciesAsync
    operation?
     
    Last edited: Dec 3, 2021
    phobos2077 and sozcan like this.
  2. su9257

    su9257

    Joined:
    Jun 13, 2017
    Posts:
    27
    I do need to abort the download operation for network or other reasons. This seems to be a lingering issue that Unity has never resolved.
     
  3. CineTek

    CineTek

    Joined:
    Jul 12, 2013
    Posts:
    98
    Also interested in this, but as a FYI - other games including e.g. Pokemon Unite do not pause their dynamic CDN downloads on iOS even if the user switches from WIFI to mobile even though it SHOULD either interrupt/pause or at least prompt the user.. at least according to Apple specifications
     
  4. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    If you don't want to wait (like, forever) for Unity to implement this obviously needed feature, you can try to do it yourself via custom asset bundle provider. Either try using the Unload method (which *should* be called when operation is released), or just write your own download management layer and add downloads to it from custom provider, then abort directly via some static member.
     
    Peter77 likes this.
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
  6. Gustavo-Santos

    Gustavo-Santos

    Joined:
    May 4, 2014
    Posts:
    13
    Currently im working in handling cancellation and restart of some tasks related to managing remote resources using addressables and unfortunately, looks like we cant cancel any Addressable API called.
    All Async methods from Addressables does not accept a CancellationToken as a argument
    So I tought, theres two more ways I can try to cancel this task:
    1 Running this operation in a coroutine, and stopping the coroutine
    2 Releasing the handle returned by the API
    For both cases I tried running a download, and cancelling it.
    I started the download, and after x seconds I downloaded 50MB/200MB, and then I tried cancelling the task by both, releasing the handle and stopping the coroutine
    after more x seconds I started again the same task to download the assets
    But now, it started from 100MB/200MB
    So looks like the download continued, do we have any confirmation of this behaviour from unity?