Addressables: Building from editor directly to Google Cloud or similar services

I’ve been looking all over the web as well as experimenting on my own but since I couldn’t find any tutorials or examples, I figured I’d ask here.

What I want to do is to be able to build addressable assets from Unity directly onto a bucket on google cloud, without having to manually upload the files on my browser. I believe setting up a custom hosting service is the way to go if I’ve understood correctly, yet I haven’t been able to figure out how to set up the script to do it.

Any help would be greatly appreciated.

bump, still struggling to achieve this. Any pointers or help?

You could always use google cli in a script that run after the addressable build to upload the bundle.
Would that work?

Yeah, I’ve already figured out how to upload to the firebase cloud through scripts but the issue is that it wouldn’t discern which assets have been updated and which haven’t, wasting time unnecessarily uploading untouched assets.

At the moment I’m trying to figure out where in the default build scripts it is determined which assets were updated in the build and somehow use that to selectively upload whatever has been updated.

We use amazon. When uploading we use asw sync local dir bucket.
That will only upload missing file on the bucket

Edit sorry a miss read you use firebase
Google seem to have something similar
~~gsutil tool  |  Cloud Storage  |  Google Cloud

No worries, I’m more than willing to use amazon instead if it means I can get this to work. Adding a missing file seems useful enough, but what about uploading the same file if it has been updated in the build?

I’m reading up on the link. Using this sync function is possible to sync a local directory with the bucket?

Yes it would sync will make the two folder be the same. If a file was updated it will replace it

Yes if it the same as amazon it work both way

Okay, will give this a shot. Thanks a lot for the tips!

    public void CycleThroughDirectory(string source)
    {
        string[] files = Directory.GetDirectories(source);
        foreach (var file in files)
        {
            FileAttributes attributes = File.GetAttributes(file);

            if (attributes.HasFlag(FileAttributes.Directory))
            {
                string[] originalSourceDir = sourceDirectory.Split('\\');
                string[] newDir = file.Split('\\');
                string extra = "";

                for (int i = originalSourceDir.Length; i < newDir.Length; i++)
                {
                    extra = extra + "/" + newDir[i];
                }

                SyncFolder(file, targetDirectory + extra, arguments);
                CycleThroughDirectory(file);
            }
        }
    }

  

    public void SyncFolder(string source, string target, string argumentsGiven = "")
    {
        Debug.Log("synching " + source);
        string strCmdText;
        if (argumentsGiven == string.Empty)
        {
            strCmdText = "/C gsutil rsync " + source + " " + target;
        }
        else
        {
            strCmdText = "/C gsutil rsync " + argumentsGiven + " " + source + " " + target;
        }
        System.Diagnostics.Process.Start("CMD.exe", strCmdText);
    }

Just a quick follow up, using the gsutil SDK I’ve managed to automate the process through this script. I post it here in case anyone finds it useful or if someone finds flaws in this

1 Like