Impossible to write custom BuildScriptPackedMode

Impossible without changing Addressables source as ContentUpdateContext and RevertUnchangedAssetsToPreviousAssetState are inaccessible…

Additionally why static methods are so overused there??? Why not protected virtual to make it easily extensible?

2 Likes

There’s more:

internal IBuildLogger m_Log;
ProjectConfigData
BuildLayoutGenerationTask
buildLayoutTask.m_BundleNameRemap

It wasn’t the case few patches ago. There were no internal types used.

2 Likes

Hey there! Happy to bounce this feedback off of the team, and relay any insight they have.

2 Likes

I’ll bring this up with the team. This is definitely something that should be possible.

My use case is to simply build Addressable Group to one folder to make modding possible. Later on content is read from a folder of Steam Workshop item and catalog.json.

No idea if there’s better way but I’m currently using modified BuildScriptPackedMode (had to make addressables package embedded). Only thing that’s missing is .hash file.

Found better way to build Group as remote one, the only problem left is error when loading them with Addressables.LoadContentCatalogAsync

internal ResourceLocationBase CreateCatalogLocationWithHashDependencies( string catalogPath, string hashFilePath )
{
    ResourceLocationBase resourceLocationBase = new ResourceLocationBase(catalogPath, catalogPath, typeof(ContentCatalogProvider).FullName, typeof(IResourceLocator));
    if ( !string.IsNullOrEmpty( hashFilePath ) )
    {
        string text = ResolveInternalId("{UnityEngine.Application.persistentDataPath}/com.unity.addressables/" + Path.GetFileName(hashFilePath));
        resourceLocationBase.Dependencies.Add( new ResourceLocationBase( hashFilePath, hashFilePath, typeof( TextDataProvider ).FullName, typeof( string ) ) );
//this below gives errors, could be fixed with if(File.Exists(text))
        resourceLocationBase.Dependencies.Add( new ResourceLocationBase( text, text, typeof( TextDataProvider ).FullName, typeof( string ) ) );
    }
    return resourceLocationBase;
}

Other than that error everything works fine, I’ve tried to copy/paste local .hash file to UnityEngine.Application.persistentDataPath}/com.unity.addressables/" + Path.GetFileName(hashFilePath) but then it stops working at all.

I’d like to chime in on this topic since I’m trying to write a custom Packed-mode script as well. There’s too much using internal-protection modifiers which doesn’t allow to properly extend or build your own packing scripts, as well as inconsistent methods of which I expect to be protected virtual but are either internal or private.

For example, I’d like to override the DoBuild-method, and actually keep most of its functionality intact by copying the contents of the base function with a few additions of my own, but can’t because a lot of the stuff isn’t accessible.