Search Unity

Feedback request: BackgroundDownload

Discussion in '2019.1 Beta' started by Aurimas-Cernius, Dec 14, 2018.

  1. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,012
    BackgroundDownload is a set of Unity plugins to download files in the background on Android, iOS and Universal Windows Platform.
    Using these plugins you can start a downloads of large files and these download will continue even if application goes into background or gets killed by Operating System. The results can be collected next time you launch application.

    Limitations:
    • Only files can be downloaded and they have to be saved to device storage, no data processing on the fly.
    • Downloaded files must be stored inside Application.persistentDataPath.
    • This isn't high performance downloader, don't use it to download small files you need immediately. But you can utilize this feature to prefetch files that will be required at some point later.

    Plugins are compatible with Unity 2018.3 and later.
    The plugins are avaiilable in a public GitHub repository here.

    Questions, suggestions and other feedback is welcome here.
     
    Lars-Steenhoff likes this.
  2. N3uRo

    N3uRo

    Joined:
    Dec 10, 2011
    Posts:
    592
    Why do you still create new APIs using IEnumerator and coroutines? I don't understand. Please use async/await/Task. I don't want to have the MonoBehaviour requirement... Why I can't run it from a plain class?
     
    Roni92pl, sinkd and M_R like this.
  3. RWatling

    RWatling

    Joined:
    Mar 21, 2018
    Posts:
    9
    I second the use of Async / Task
     
  4. N3uRo

    N3uRo

    Joined:
    Dec 10, 2011
    Posts:
    592
    @Aurimas-Cernius Any thoughts? If you are going to remove 3.5 backend in 2019.x it's the right time to start making new APIs using async pattern.

    I read that addressables APIs it's going to do it also.
     
  5. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    3,227
    How come the C# code does not follow Unity's naming guidelines?

    For example, in Unity's C# reference source code, static fields are prefixed with s_ and non-public instance fields with m_. The BackgroundDownload source code does not seem to do this.
     
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,012
    Yes, I'm planning to add support for async.
     
  7. N3uRo

    N3uRo

    Joined:
    Dec 10, 2011
    Posts:
    592
    Great!

    Have you discussed this internally in order to apply it to other classes that have sense like for example UnityWebRequest, Resources, AssetBundle, SceneManager in methods that load assets?

    Thanks.
     
  8. hefanst

    hefanst

    Joined:
    Nov 1, 2017
    Posts:
    2
    Can i use it in thread?
     
  9. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,012
    Currently - no. What's the use case for using it in thread?
     
  10. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    15
    So far i now, Unity will using the standard C# naming guidelines in the "Unity" Namespace, but also they not follow them....
    Only for to non-private fields (public or protected)
     
  11. hefanst

    hefanst

    Joined:
    Nov 1, 2017
    Posts:
    2
    I just wanna download resources silently in another thread when the program is running, and keeping download when the game is in background.
     
  12. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,012
    The background download do happen on another thread regardless whether app is running or not, so a separate thread in your app for a download is essentially useless.