Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Build for Content Update using Command line

Discussion in 'Addressables' started by locbh, Nov 10, 2019.

  1. locbh

    locbh

    Joined:
    Sep 11, 2017
    Posts:
    10
    Hi there,
    How can I build addressable bundles fỏ content update using cli?

    Also, I couldn't see StaticContent tick box anymore
     
  2. locbh

    locbh

    Joined:
    Sep 11, 2017
    Posts:
    10
    I found some code for that in the Editor:

    Code (CSharp):
    1.  
    2. var modifiedEntries = ContentUpdateScript.GatherModifiedEntries(AddressableAssetSettingsDefaultObject.Settings, buildPath);
    3.  
    4. ContentUpdateScript.CreateContentUpdateGroup(AddressableAssetSettingsDefaultObject.Settings, modifiedEntries, "Content Update");
    5.  
    6. AddressableAssetSettings.BuildPlayerContent();
     
  3. zhuxianzhi

    zhuxianzhi

    Joined:
    Mar 30, 2015
    Posts:
    122
    Code (CSharp):
    1.  
    2. public static void ShellBuild(string profile ="Default")
    3. {
    4.  
    5.     var aaSettings = AddressableAssetSettingsDefaultObject.Settings;
    6.  
    7.     if (aaSettings != null && aaSettings.BuildRemoteCatalog)
    8.     {
    9.         var id = aaSettings.profileSettings.GetProfileId(profile);
    10.         aaSettings.activeProfileId = id;
    11.         string path = ContentUpdateScript.GetContentStateDataPath(false);
    12.         if (File.Exists(path))
    13.         {
    14.             ContentUpdateScript.BuildContentUpdate(AddressableAssetSettingsDefaultObject.Settings, path);
    15.         }
    16.         else
    17.         {
    18.             AddressableAssetSettings.BuildPlayerContent();
    19.         }
    20.     }
    21.     else
    22.     {
    23.         AddressableAssetSettings.BuildPlayerContent();
    24.     }
    25. }
    26.  
     
    FernandoHC, silkms and PumpKlN like this.
  4. locbh

    locbh

    Joined:
    Sep 11, 2017
    Posts:
    10
    Awesome. Thank you!
     
  5. Domarius

    Domarius

    Joined:
    Jan 5, 2013
    Posts:
    103
    I was expecting to see a commandline argument, like "unity.exe -buildAddressableAssets", how does one use this script? Is there a way to truely do it via the commandline?