Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

ContentUpdateSchema Static vs Non-Static

Discussion in 'Addressables' started by MNNoxMortem, Dec 17, 2018.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    119
    What does this flag exactly do?

    I mean it is explained here as https://docs.unity3d.com/Packages/c...DevelopmentCycle.html#content-update-workflow

    Code (CSharp):
    1. The recommended approach to content updates is to structure your game data into two groups: static content that you expect never to update and dynamic content that you expect to update. In this content structure, static content ships with the Player (or download soon after install) and resides in a single or a few large bundles. Dynamic content resides online and should be in smaller bundles to minimize the amount of data needed for each update. One of the goals of the Addressables system is to make this structure easy to work with and modify without having to change scripts. Sometimes you find yourself in a situation that requires changes to the "never update" content but you do not want to publish a full player build
    I understand this as: I can do with static bundles exactly the same as I can do with non-static ones and there is nothing I can't do with non-static ones. For every group I am able to set where I want the bundle to be build to and loaded from.

    The only difference seems to be what is written to the *.bin file, which is required for Content Updates.

    It would be really nice if we get a bit more information on how to properly set those groups up and a bit more detail about the Content Update would be nice. I'm currently trying to follow the linked explanation, but there are some weird thing which looks more like missing features/bugs than actual intended workflow:
    • A change to a group, marked as static build to "LocalBuild" and loaded from "LocalLoad" will result in the asset moved to a new group ContentUpdate group with settings "non-static" and "RemoteBuild" and "RemoteLoad" as locations.
    • The AssetBundles are platform dependent but it looks like I have to manually set the current platform, change the Addressable Profile to my platform dependent setting profile and delete whatever other bundles were build to Streaming Assets from other platforms to not have them copied all together.
    Also one question I have: When am I actually required to publish a full player build? I mean there are some obvious scenarios, but where approximatively is the breaking point? I have so many questions about the robustness of the system and seem to find little information about that (although I assume the answer is "it is as with Asset Bundles" - but I never used them before and there is not much information about them either as obviously the minority of users really seem to have adopted them).
     
  2. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    294
    I will note that we need to update our docs. In the interim, please watch the last Unite talk and let me know if you still have questions:

     
  3. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    119
    @unity_bill Have I missed it? Watched it and there is no deeper explanation of the static flag?

    Unless you are referring to the slide on 23:42. Is this the ONLY thing static does? When would I use "non-static" then? I want to be able to update all bundles via prepare for content-update / build for content update but 23:42 sounds like prepare will "only" detect changes in "static" marked content.

    [29:42] What especially confuses me is that the "local Demo Data" must be "static" but the "content update" has not ticked "static". Am I not able to update the "content update" later again? How would it detect subsequent changes down the road (updates of updates of updates).
     
    Last edited: Dec 19, 2018
  4. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    294
    let's have this example:
    groupA_static
    - assetA
    - assetB
    - assetC
    groupB_nonStatic
    - assetX
    - assetY
    - assetZ

    now you change assetA and assetX. Prepare will do this:
    groupA_static
    - assetB
    - assetC
    groupB_nonStatic
    - assetX
    - assetY
    - assetZ
    content_update_group
    - assetA

    so static tells the prepare step "is this a group that can or cannot be updated post-launch". Note that groupA_static did technically change, but it changed only via removal. So after the build, you can discard the new groupA_static since the pre-existing one has all the same content (and then some)

    hope that helps
     
  5. CC9

    CC9

    Joined:
    Mar 20, 2013
    Posts:
    3
    @unity_bill Just for clarification:

    Setting Static content to true signals it as a group that CAN be updated post-launch, while setting to false flags it as a group that CAN NOT be updated post launch? The fact that the static group changed (removal of A) in your ABC,XYZ seems counter-intuitive and thus the confusion.

    Thanks.
     
    MNNoxMortem likes this.
  6. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    397
    I think that you understood it wrong, quoting bill here:
    @unity_bill correct me if I'm wrong, but what I understood is that if you set it to static it will mean that it cannot be updated post-launch, hence the static. After the build the content was updated on the old (original) groupA_static instead of a new update, which is why you can discard the new groupA_static.
     
  7. CC9

    CC9

    Joined:
    Mar 20, 2013
    Posts:
    3
    @Rotary-Heart Yeah, I felt like I might be since it uses the word static but I wasn't sure. I've been trying to assess which way to do it but I have a fairly large project so generating bundles is a timely process.
     
  8. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    294
    ok, I wasn't totally clear. Static does mean unchangeable, even though it "changed" in my example. Here's what I mean. I have the two bundles as stated, and then, also as already stated, I change A and X to end up with:
    groupA_static
    - assetB
    - assetC
    groupB_nonStatic
    - assetX
    - assetY
    - assetZ
    content_update_group
    - assetA

    so far this is all copied from above. The thing I didn't clarify originally, is that this group layout is what Addressables will setup in your project. This gives you the ability to build bundles, then put groupB_nonStatic and content_update_group up on your CDN. Then on the users device, they'll end up with:
    groupA_static <--old, already existed
    - assetA <-- no longer referenced by the content catalog.
    - assetB
    - assetC
    groupB_nonStatic <--newly downloaded
    - assetX <-- updated thanks to new download
    - assetY
    - assetZ
    content_update_group <-- newly downloaded
    - assetA <-- what is referenced by new content catalog

    so yes, locally we change the group layout, so that when we build, we'll get the proper remote bundles.

    That help?

    -Bill
     
    MNNoxMortem likes this.
  9. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    119
    @unity_bill Thank you that helps a lot. I guess my main question is why would I ever want to mark something not as static.
    • groupB_nonStatic is completly rebuild although assetY and assetZ did not even change. It is also uploaded in full size again and downloaded in full size
    • The adressable asset system hides the fact that assetA is in content_update_group anyway. groupA_static would be on the server already anyway and the hash has changed because of the change to assetX
    Maybe I still have a mental roadblock but nonStatic looks worse in any scenario to me.
     
  10. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    294
    to show the pros/cons of static, let's look at toggling static ON for groupB. What you end up with on the server is:

    groupB_static <-- original, unchanged bundle
    - assetX <-- dead asset with no one referencing it.
    - assetY
    - assetZ
    content_update_group
    - assetX

    So imagine assetX was a huge texture. If the user has already downloaded groupB, they will have to keep that in their cache (potentially re-downloading if cache is cleared) because Y and Z are still referenced. And they have to download the new content_update_group. If they have not downloaded groupB yet, then they now have to download both bundles, which causes them to download X twice. Once as the dead copy in groupB, once as the new one.

    So what's better? having a dead X to download/cache, or having to re-download Y/Z even though they haven't changed? depends on your situation.
     
    MNNoxMortem likes this.
  11. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    119
    Thank you so much, now I finally got it.