Search Unity

  1. Unity 2019.2 is now released.
    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:
    9
    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:
    9
    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:
    31
    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.  
     
  4. locbh

    locbh

    Joined:
    Sep 11, 2017
    Posts:
    9
    Awesome. Thank you!