Search Unity

[bug] asset groups/bundles cannot have some chars in names/paths

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

  1. nik_d

    nik_d

    Joined:
    Apr 27, 2018
    Posts:
    66
    workaround: in BuildScriptPackedMode.cs - GenerateBuildInputDefinitions(...)

    Code (CSharp):
    1.                 buildInputDefs.Add(GenerateBuildInputDefinition(assets, groupName + "_assets_" + address)); //**addressables: workaround - removed extension here to remove dots later
    2. .........
    3.             { //**addressables: workaround for https://issuetracker.unity3d.com/issues/android-gradle-streamingassets-starting-with-an-underscore-not-included-in-builds
    4.                 var names = assetsInputDef.assetBundleName.Split('/');
    5.                 assetsInputDef.assetBundleName = string.Join("/", names.Select(part => part.TrimStart('_')));
    6.             }
    7.             { //**addressables: workaround for names with strange chars
    8.                 //    fixup for local hosting: bad in bundle names with f.e. %60 (`)
    9.                 //    fixup for android build: don't allow single quote (') because of its usage in build.gradle
    10.                 //    fixup for cached checking: remove any dots (.) except extension otherwise Caching.IsVersionCached failed
    11.                 assetsInputDef.assetBundleName = assetsInputDef.assetBundleName
    12.                         .Replace("`", "_")
    13.                         .Replace("'", "_")
    14.                         .Replace(".", "_")
    15.                     ;
    16.                 assetsInputDef.assetBundleName += ".bundle";
    17.             }
    18.