Search Unity

tvOS purging on-demand resources & iOS ODR using mobile data

Discussion in 'iOS and tvOS' started by yakandco, Jun 14, 2016.

  1. yakandco

    yakandco

    Joined:
    Dec 3, 2014
    Posts:
    90
    Hi there,

    I've got a couple of questions to throw out there, I've searched around in the forums and general googling, haven't had much luck finding anything solid.

    I've read that tvOS can purge on-demand resources if it needs to reclaim data that hasn't been used in a while. What I'm wondering is how this could affect a unity game if/when this happens - is it the case that Unity's implementation doesn't flag the content as 'not required anymore', so its never considered by the OS as a candidate to purge? or are there some Unity API methods to ask f an asset bundle is still available or not, and whether or not it needs to download them again? I'm just about to start coding an ODR loader and wanted to check this in case my code needs to be a little smarter to double check for the assets before each use, instead of for example loading them once and setting a userprefs flag that it's loaded when potentially under the hood the data has now been purged.

    The next question is how or if anyone is doing anything "nice" to inform users that ODR assets are being downloaded potentially using their mobile 3G/4G/LTE data? It's seems strange to me that one of the reasons for the 100mb over the air limit is to prevent instances of users having their costly mobile data being hit hard, but then sneaky background loading of ODR assets potentially undermines this.

    Ideally we want to be able to smartly load upcoming scenes/assets in order to offer a seamless experience though. So I'm just feeling like I'm missing something here because for cases where an app could drain a users mobile data allowance or rack up a massive bill for them, the blame would probably fall on the developer for not informing them. Does any one have any insight to this issue or know if there is any iOS functionality that kicks in and warns a user in the same way that it does when attempting to download an app from the store that is over 100mb?

    As I said for the most part for our games I'd be preloading the next scene in the background with the user completely unaware, and only if they caught up to an unloaded scene due to a slow connection would they see a preloader. If I had a preloaded this is where I could add some feedback on how much mb's is being downloaded and possibly add a pause download button.. but under most circumstances they'd never see this, it would probably finish loading before hitting the new scene. On that note, I do know that the iOS API has a method for pausing ODR downloads, but does Unity have a way to call it?

    Thanks all, really appreciate any thoughts or comments on these topics, cheers!

    Jason
     
  2. yakandco

    yakandco

    Joined:
    Dec 3, 2014
    Posts:
    90
    No on-demand resource geniuses out there by any chance? haha :)
     
  3. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    531
    Giving this a bump in the hope that someone catches it again.. it's been months with no reply, so hopefully bumping it is ok, thanks!! =)
     
  4. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    When you use ODR with Unity, you are in control of when the resources are marked as unused. See https://docs.unity3d.com/ScriptReference/iOS.OnDemandResourcesRequest.Dispose.html
    There's no API in Unity that would allow you to get this information. Is there any way to do this at all (from objective-c for example)?