ContentUpdateScript.GetContentStateDataPath returns relative path when param browse is false

I am working on a tool to automate content update progress and I am trying to use ContentUpdateScript.GetContentStateDataPath(bool browse) to get the path of the bin file automatically.

However when the parameter browse is set to false, the path returned is a relative path while when it is true (which is the case if we update content with the addressable group window), a full path is returned.

This leads to repacking of all bundles in my build script, even though none of the assets are changed.

I wonder if I got something wrong, or is it an actual bug that will be fixed in the future?

Could you share which version of the addressables package you’re currently using, as well as what version of the Editor you’re using? That will help us be able to help you. Thanks!

I’m using Addressables 1.5.0 and Unity 2019.2.0f1, thanks!

I guess I found whats wrong!

My build script contains a feature that swaps entries to an encrypted variant inside the ProcessGroup function with the following code:

private static AddressableAssetEntry _ReplaceOriginalEntryWithFilePath( AddressableAssetGroup @group,
        AddressableAssetsBuildContext aaContext, AddressableAssetEntry originalEntry, string newFilePath )
    {
        var newEntry = aaContext.settings.CreateOrMoveEntry( AssetDatabase.AssetPathToGUID( newFilePath ), @group );
        newEntry.address = originalEntry.address;
        foreach ( var label in originalEntry.labels )
        {
            newEntry.SetLabel( label, true );
        }
        return newEntry;
    }

The changes will be rolled back after buildImplementation:

for(int i = 0; i < _encryptedEntries.Count ; i ++)
        {
            var parentGroup = _encryptedEntries[i].parentGroup;
            settings.RemoveAssetEntry( _encryptedEntries[i].guid );          
            var entry = settings.CreateOrMoveEntry( _originalEntries[i].guid, parentGroup );
          
            entry.SetAddress( _originalEntries[i].address );
            foreach ( var label in _encryptedEntries[i].labels )
            {
                entry.SetLabel( label, true );
            }          
        }

I copied this flow from the Texture Variant Sample in Addressables Sample here: GitHub - Unity-Technologies/Addressables-Sample: Demo project using Addressables package.

While it works, after building with this build script, git shows that there are changes in the addressable asset entry, showing that m_mainAssetType became null:
5345064--539538--upload_2020-1-7_18-1-14.png

If I continue to build addressable without discarding this change, Addressables will repack all bundles even though there is nothing changed in that entry. But if I discard it everything works like a charm! I guess that that changes somewhat changed the hash of entry and triggered repack of bundles?

I wonder if I missed anything in my build script - any help is appreciated!

Updating again as it turns out the solution above doesn’t really work, and that the actual reason for bundles to rebuilt is because I used AssetDatabase.CopyAsset when copying raw assets to the encrypted variants.

This changes the GUID of the asset and leads to rebuilding ALL bundles in the group, even if the bundle mode of the group is pack separately.

For now I changed AssetDatabase.CopyAsset to File.Copy as a workaround. So far it works, but I will update again if anything breaks again.

Since this is a completely different problem from what this thread is originally for, I started a new one here: https://forum.unity.com/threads/changing-entry-guid-in-a-group-that-packs-bundles-separately-will-rebuilt-all-bundles-in-the-group.808152/