To expand on the title, in my project there’s a block of code that is essentially this:
public static IEnumerator LoadCatalog(string catalogPath)
{
Debug.Log($"Loading catalog... ({File.Exists(catalogPath)})");
var loadCat = Addressables.LoadContentCatalogAsync(catalogPath);
while (!loadCat.IsDone) yield return null;
Debug.Log("Catalog loaded.");
}
This code works in the editor and also when I do a local build. Additionally, I’ve built this for iOS and for PC; both work fine. However, when I build through Unity Cloud Build, the resulting app hangs on LoadContentCatalogAsync. I can tell from the Debug that (1) the catalog exists and (2) the app is not reaching the second Debug line.
I had working cloud builds when I was using AssetBundles, but have been hung up on this one line since switching to Addressables, hence why I’m posting on this forum instead of the Unity Cloud Build forum, but I can move the question if necessary.
I’m working with Unity 2019.3.0f6 and with Addressables 1.6.0. Thanks for any help.
As far as I’m aware, I don’t have a build script. Or at least I never made one. I inherited this project from someone else and I don’t see any scripts in the project that look like build scripts.
(Edit: I should clarify that I inherited this project about a year ago and have had many successful builds up until now when I introduced Addressables into the project.)
Oh, are you building the addressables separately, uploading them somewhere, then running the engine build? That would make sense why it doesn’t work. I build the addressables as part of my build script before the engine build so that it will work whether I run it locally or on the build server.
Sure. So what I do here is build the addressables to a folder outside of Assets like they recommend, then I compress the output with gzip, then I move the entire thing to StreamingAssets, then I build the engine.
So, obviously this does a full build every time, rather than simply updating an existing build, so it’s not as efficient as it could be, depending what you need to do.
Keep in mind that, with this code in particular, the Application.streamingAssetsPath + "/AssetBundles" must not already exist.
@ProtoTerminator Your advice steered me in the right direction, but since my solution had to be a little different, I’m going to detail it here for the sake of others.
As I’ve discovered over the course of this thread, Addressables keeps some platform-specific files in the Library folder of your project outside of the Assets folder. When building locally, it copies these files into the StreamingAssets folder and then deletes them after the build. This way, your program can build for multiple platforms without you worrying about conflicting files. However, since Unity Cloud Build does not have access to your Library folder, it cannot copy these files for you.
What I essentially did is manually copy the folder Library/com.unity.addressables/StreamingAssetsCopy/aa into my Assets/StreamingAssets folder and push my changes up to the cloud using Unity Collaborate. This gave me a build that worked.
It’s important to note that building locally will delete that folder out of StreamingAssets again, so I will have to repeat this process every time I build from the cloud. I’ll probably end up writing an editor module that does this whole copy process and then starts the cloud build from within the editor, but one step at a time.
Thanks for your help, @ProtoTerminator . If anyone needs me to explain this better or differently, let me know.