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

Proper way to load scenes from remote

Discussion in 'Addressables' started by gr1ns1de, Aug 24, 2019.

  1. gr1ns1de

    gr1ns1de

    Joined:
    Feb 14, 2015
    Posts:
    4
    Hi,
    In my mobile android project 10+ scenes (size 100±50mb) and i want client to load/update them from remote server on game starts.

    I can see client creation pipeline like this:

    1. Override player version to 1 (in AddressableAssetSettings -> General)
    2. Create nonStatic(2*) group for each scene
    groupA_nonStatic
    - sceneA
    groupB_nonStatic
    - sceneB

    3. Start “Build player content”
    4. Send builded hash, catalog and bundles with overridden version 1 to remote server.
    5. Build game .APK


    So now new client will expect bundles with version 1 on remote server.

    In case if I had change sceneA and need to update it:

    1. Start “Build player content”
    2. Send builded hash, catalog and bundles with overridden version 1 to remote server.

    What I imagine happens on client’s device in result:

    groupA_nonStatic(old) <- not referenced and will be removed from device cache.(3*)
    - sceneA <- not referenced with new catalog
    groupB_nonStatic <- stays as it was
    - sceneB <- not changed

    groupA_nonStatic(new) <- now it’s referenced for all clients with any game build version which expects bundles version 1.
    - sceneA

    Here is my general questions:
    1. Was my thoughts correct? Is it proper way to handle my assets for device cache memory management?
    2*. Static or nonStatic group - I suppose it doesn’t matter in my case? I mean if create group for each asset.
    3*. When not referenced groups will be cleaned up?

    P.S. Your work inspires, thanks in advance :)
     
  2. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    1. that should work, but I'd recommend using "build for content update" during the update phase instead of rerunning "build player content". Since you are manually overriding the version, you might not have to do that. I can't remember the exact implications off the top of my head.
    2. it only matters if you do "build for content update". But in general, if it's online, it should be non-static
    3. yes, based on your cache settings. You should by default have one asset listed as an "initialization object" within the inspector for the addressable asset settings. The one we make by default is a "CacheInitializationSettings" object. This allows you to control when things age-out of the cache.
     
  3. simbaDraco

    simbaDraco

    Joined:
    Oct 16, 2014
    Posts:
    18
    The scenes on remote have failed to load from S3 buckets in build , but work in editor.