Search Unity

[feature] bundle names without hash

Discussion in 'Addressables' started by nik_d, Jun 12, 2019.

  1. nik_d

    nik_d

    Joined:
    Apr 27, 2018
    Posts:
    66
    premiss: bundles are built always in different folders
    workaround: in BundledAssetGroupSchema.cs:
    Code (CSharp):
    1.         //**addressables - bundles without hash in name support
    2.         [SerializeField]
    3.         private bool m_RenameUsingHash;
    4.         public bool RenameUsingHash
    5.         {
    6.             get => m_RenameUsingHash;
    7.             set
    8.             {
    9.                 m_RenameUsingHash = value;
    10.                 SetDirty(true);
    11.             }
    12.         }
    in BuildScriptPackedMode.cs PostProcessBundles(...):

    Code (CSharp):
    1.                     if (schema.RenameUsingHash) //**addressables - bundles without hash in name support
    2.                     {
    3.                         dataEntry.InternalId = dataEntry.InternalId.Replace(".bundle", "_" + info.Hash + ".bundle");
    4.                         newBundleName = newBundleName.Replace(".bundle", "_" + info.Hash + ".bundle");
    5.                     }
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    bundles for different platforms are in different folders, but not build-to-build of a given platform.

    I could see exposing this as an option, but definitely not defaulting to it. the hash enables you to have new and old data on a given server without worry of stomping something that an old build is looking for. On our to-do is to create an option to be hash-only. Once we get to that, we could probably make "no hash" an option as well.