(group_unitybuiltinshaders.bundle) can't be loaded because the same files is already loaded error

I am trying to load one catalog that loads some content but when I try to load a second I am getting an error

can’t be loaded because another AssetBundle with the same files is already loaded.

This is happening with an asset bundle that is being buily with each catalog for
the “group_unitybuiltinshaders_string.bundle”

they are all named with the same bundle name just with a different “group” name depending on which goup they are in.

How do I get past this error?

Hi, we faced the same situation on our end. Unfortunately, I’m not sure whether this can be solved using settings applied in the Addressables configuration alone. The problem as far as I can see was that the bundle always gets built, even when you set the ‘Include in build’ setting to false.

In my previous use of Addressables, I modified the package to take this setting into account. (This was on version 1.13.1 however, not sure how compatible this is with newer versions)

In the DoBuild method of the BuildScriptPackedMode I modified it like this:

IList<IBuildTask> buildTasks = null;
if (aaContext.Settings.DefaultGroup.GetSchema<BundledAssetGroupSchema>().IncludeInBuild)
{
    var builtinShaderBundleName = aaContext.Settings.DefaultGroup.Guid + "_unitybuiltinshaders.bundle";
    buildTasks = RuntimeDataBuildTasks(new CreateBuiltInShadersBundle(builtinShaderBundleName));
}
else
{
    buildTasks = RuntimeDataBuildTasks();
}

buildTasks.Add(extractData);

And then modified the RuntimeDataBuildTasks method further down below to:

static IList<IBuildTask> RuntimeDataBuildTasks(CreateBuiltInShadersBundle builtInShaderBundle = null)
{
    var buildTasks = new List<IBuildTask>();

    // Setup
    buildTasks.Add(new SwitchToBuildPlatform());
    buildTasks.Add(new RebuildSpriteAtlasCache());

    // Player Scripts
    buildTasks.Add(new BuildPlayerScripts());

    // Dependency
    buildTasks.Add(new CalculateSceneDependencyData());
    buildTasks.Add(new CalculateAssetDependencyData());
    buildTasks.Add(new AddHashToBundleNameTask());
    buildTasks.Add(new StripUnusedSpriteSources());

    if (builtInShaderBundle != null)
    {
        buildTasks.Add(builtInShaderBundle);
    }

    // Packing
    buildTasks.Add(new GenerateBundlePacking());
    buildTasks.Add(new UpdateBundleObjectLayout());

    buildTasks.Add(new GenerateBundleCommands());
    buildTasks.Add(new GenerateSubAssetPathMaps());
    buildTasks.Add(new GenerateBundleMaps());

    // Writing
    buildTasks.Add(new WriteSerializedFiles());
    buildTasks.Add(new ArchiveAndCompressBundles());
    buildTasks.Add(new GenerateLocationListsTask());

    return buildTasks;
}

This skips the built-in shader group when the ‘Default Build’ group is being disabled from the build.

I’m not entirely sure about your setup or requirements, but perhaps you can also have a look at this thread. It explores how to build for multiple catalogs in one go, where assets in an external catalog can depend on assets being included in the main game.

Hope that helps. :slight_smile:

@LuGus-Jan thanks for the response. I did find this searching around, tried it and it works. Specifically KospY’s comment.

“I just saw that addressable 1.17.5-preview added an option to set custom prefix on the unitybuiltinshader AssetBundle! I updated to this version and set the option to “default group GUID” and the problem is gone!!”