Version: 2021.2
Unity CCD Develop Dashboard
Unity IAP

Using CCD via the command-line interface

Important: The Unity Cloud Content Delivery documentation has moved to docs.unity.com. Please visit the new site for the most up to date information about Unity CCD.

This section contains a full example of how to use Cloud Content Delivery (CCD) via the command-line interface (CLI), including the following topics:

Authentication

Log into the service using your API key. See the Getting started section if you need help locating your API key.

$ ucd auth login XXXXXXXXXXXX
Login successful.

Verify whether you are logged in with the auth info command.

$ ucd auth info
Current user: Joe Smith

Creating a bucket

Create your first bucket. Buckets are associated with a single project. The Project ID for this example is e1942cea-12df-4220-aa6d-f8c9c3ab7526, but you need to use one of your actual Project IDs. See the Getting started section if you need help locating your Project ID.

List the buckets (which should be empty at this point) for this project.

$ ucd buckets list e1942cea-12df-4220-aa6d-f8c9c3ab7526
No buckets found for project.

Create a bucket called example_bucket for this project:

$ ucd buckets create e1942cea-12df-4220-aa6d-f8c9c3ab7526 example_bucket
Created bucket: example_bucket (aee9ee5f-fa01-46d3-a293-731d15f066cf)

Bucket and entry names are case sensitive.

To see the newly-created buckets, list the buckets again for this project:

$ ucd buckets list e1942cea-12df-4220-aa6d-f8c9c3ab7526
Buckets for project (e1942cea-12df-4220-aa6d-f8c9c3ab7526):
- example_bucket (aee9ee5f-fa01-46d3-a293-731d15f066cf)

To make it easier to work with creating entries and releases, save the newly-created bucket to the local configuration (don’t provide it as a parameter to the CLI for every operation). Copy the bucket’s GUID (not its name) from the bucket creation message above (aee9ee5f-fa01-46d3-a293-731d15f066cf in this example):

$ ucd config set bucket aee9ee5f-fa01-46d3-a293-731d15f066cf
Successfully switched to bucket aee9ee5f-fa01-46d3-a293-731d15f066cf.
Currently active project: e1942cea-12df-4220-aa6d-f8c9c3ab7526.
Currently active bucket: aee9ee5f-fa01-46d3-a293-731d15f066cf (example_bucket).

CCD automatically performs any commands relating to entries and releases on the bucket you specified.

Creating entries in the bucket

List entries in this newly-created bucket (it should be empty):

$ ucd entries list
No Entries found for current bucket.

Synchronize all the files in a local folder that contains generated AssetBundles:

$ ucd entries sync ./ServerData/StandaloneOSX
Calculating...
Added Entry: catalog_2019.07.30.18.24.34.hash
Added Entry: catalog_2019.07.30.18.24.34.json
Added Entry: remotedemodata_green.bundle
Added Entry: remotedemodata_mat1.bundle
Added Entry: remotedemodata_sphere.bundle
Added Entry: remotedemodata_unitylogo.bundle
Added Entry: remotedemodata_unitylogoprefab.bundle
Added Entry: remotedemodata_scenes_scene2.bundle
Added Entry: remotedemodata_scenes_scene.bundle
Added Entry: spaceshooterdata_done_asteroid01.bundle
Added Entry: spaceshooterdata_done_asteroid02.bundle
Added Entry: spaceshooterdata_done_asteroid03.bundle
Added Entry: spaceshooterdata_done_bolt-enemy.bundle
Added Entry: spaceshooterdata_done_bolt.bundle
Added Entry: spaceshooterdata_done_enemyship.bundle
Added Entry: spaceshooterdata_done_player.bundle
Added Entry: spaceshooterdata_engines_enemy.bundle
Added Entry: spaceshooterdata_engines_player.bundle
Added Entry: spaceshooterdata_explosion_asteroid.bundle
Added Entry: spaceshooterdata_explosion_enemy.bundle
Added Entry: spaceshooterdata_explosion_player.bundle
Added Entry: spaceshooterdata_starfield.bundle
Complete! Bytes uploaded: 5346781

This adds the files as entries to the bucket. You can list the bucket’s contents and see some basic information about each entry:

$ ucd entries list
22 entries for current bucket (aee9ee5f-fa01-46d3-a293-731d15f066cf):
2019-08-21 14:27:03       167915 spaceshooterdata_starfield.bundle
2019-08-21 14:27:00       573539 spaceshooterdata_explosion_player.bundle
2019-08-21 14:26:56       412235 spaceshooterdata_explosion_enemy.bundle
2019-08-21 14:26:52       382630 spaceshooterdata_explosion_asteroid.bundle
2019-08-21 14:26:49       177018 spaceshooterdata_engines_player.bundle
2019-08-21 14:26:45       157215 spaceshooterdata_engines_enemy.bundle
2019-08-21 14:26:42      1085518 spaceshooterdata_done_player.bundle
2019-08-21 14:26:38      1070297 spaceshooterdata_done_enemyship.bundle
2019-08-21 14:26:34        27178 spaceshooterdata_done_bolt.bundle
2019-08-21 14:26:31        28362 spaceshooterdata_done_bolt-enemy.bundle
2019-08-21 14:26:28       231658 spaceshooterdata_done_asteroid03.bundle
2019-08-21 14:26:24       221450 spaceshooterdata_done_asteroid02.bundle
2019-08-21 14:26:20       227842 spaceshooterdata_done_asteroid01.bundle
2019-08-21 14:26:17        23016 remotedemodata_scenes_scene.bundle
2019-08-21 14:26:13        23064 remotedemodata_scenes_scene2.bundle
2019-08-21 14:26:10        10568 remotedemodata_unitylogoprefab.bundle
2019-08-21 14:26:07       462522 remotedemodata_unitylogo.bundle
2019-08-21 14:26:03         7864 remotedemodata_sphere.bundle
2019-08-21 14:26:00         6320 remotedemodata_mat1.bundle
2019-08-21 14:25:57         6320 remotedemodata_green.bundle
2019-08-21 14:25:53        44218 catalog_2019.07.30.18.24.34.json
2019-08-21 14:25:50           32 catalog_2019.07.30.18.24.34.hash

To get more detailed information about a specific entry, use the entries info command with the path of the entry:

$ ucd entries info spaceshooterdata_starfield.bundle`

Entry Info:
Path: spaceshooterdata_starfield.bundle
Id: 8ac46783-be01-4a47-b23e-74233fc7cc09
Last Modified: 2019-08-21 14:27:03
  Content Size: 167915
  Content Hash: 4a3ad5b69bd489699d1909e8868a7cb1
  Content Type: application/octet-stream
  Content Link: …
  Labels:
  Metadata:
  Current Version: aa0304db-fd9f-4772-9549-dfeb44cc6d6f

Your game client can now request content for an individual file in the bucket using the path associated with the entry. Make all game client requests to your project-specific subdomain at <project_guid>.client-api.unity3dusercontent.com. The URLs all begin with /client_api/v1/ in the request path. None of these client requests require authentication.

To get the content of an entry, such as spaceshooterdata_starfield.bundle, by path, enter:

https://<project_guid>.client-api.unity3dusercontent.com/client_api/v1/buckets/aee9ee5f-fa01-46d3-a293-731d15f066cf/entry_by_path/content/?path=spaceshooterdata_starfield.bundle

Or to get the content of an entry by Entry ID, enter:

https://<project_guid>.client-api.unity3dusercontent.com/client_api/v1/buckets/aee9ee5f-fa01-46d3-a293-731d15f066cf/entries/8ac46783-be01-4a47-b23e-74233fc7cc09/content/

Creating a release

Create a release from the current state of your entries:

$ ucd releases create
Created release (#1) in bucket (aee9ee5f-fa01-46d3-a293-731d15f066cf).
  Id: 80653663-eb39-45e7-9323-e34b23df0d75
  Created: 2019-08-21 14:27:30
  ...

This allows you to use these exact versions of those entries when requesting content, even if you update or remove those entries later.

To get more detailed information about a release, use the releases info command and provide the ID of the release that you just created:

$ ucd releases info 80653663-eb39-45e7-9323-e34b23df0d75

Release #1:
  Id: 80653663-eb39-45e7-9323-e34b23df0d75
  Created: 2019-08-21 14:27:30
  Content Size: 123456
  Content Hash: b62343cb3582a7de1286dd3cf23c3592
  Notes:
  Metadata: 
  Entries:
  - remotedemodata_scenes_scene2.bundle  (version: d7c69bc0-5c0b-4625-8a7d-94a4972aa236)
  - remotedemodata_unitylogo.bundle  (version: 97d3659f-0b74-403a-be67-02641ce2dc91)
  - spaceshooterdata_done_enemyship.bundle  (version: edcedc81-80b6-4006-9732-0444898fcffa)
  - remotedemodata_unitylogoprefab.bundle  (version: 4edfa2be-7fae-44c9-bb45-f601cc1130db)
  - spaceshooterdata_done_bolt-enemy.bundle  (version: ef36bfa8-8b24-4b81-a329-b3fad0a0939b)
  ...

To get a list of all releases you generated in this bucket, enter:

$ ucd releases list
Releases for current bucket (aee9ee5f-fa01-46d3-a293-731d15f066cf): 
  2019-08-21 14:27:30  #1 (80653663-eb39-45e7-9323-e34b23df0d75)

You can now directly reference the content contained within this release. This ensures you get the exact set of content that CCD uses to generate the release even if you change the entries later in the bucket.

To get the content of an entry, such as spaceshooterdata_starfield.bundle, by path, enter:

https://<project_guid>.client-api.unity3dusercontent.com/client_api/v1/buckets/aee9ee5f-fa01-46d3-a293-731d15f066cf/releases/80653663-eb39-45e7-9323-e34b23df0d75/entry_by_path/content/?path=spaceshooterdata_starfield.bundle

Or to get the content of an entry by Entry ID, enter:

https://<project_guid>.client-api.unity3dusercontent.com/client_api/v1/buckets/aee9ee5f-fa01-46d3-a293-731d15f066cf/releases/80653663-eb39-45e7-9323-e34b23df0d75/entries/8ac46783-be01-4a47-b23e-74233fc7cc09/content/

You can also request the content that corresponds to the latest release in the bucket, so the client does not need to change each time CCD generates a new release. To do this, update the request to use the release_by_badge route and specify a badge name of latest (see Managing badges). For example:

https://<project_guid>.client-api.unity3dusercontent.com/client_api/v1/buckets/aee9ee5f-fa01-46d3-a293-731d15f066cf/release_by_badge/latest/entry_by_path/content/?path=spaceshooterdata_starfield.bundle

Managing badges

After generating a release, you can apply a badge that uniquely identifies the release. A badge can only ever point to a single release within a bucket, but you can move badges between releases. At runtime, you can query content using the badge name rather than a specific release ID, allowing for more flexibility in workflows.

For example, you might apply a badge called qa_latest to the latest release for your QA team to use, and move that badge to each new release as part of a process (manual or automated).

To add a badge named my_first_badge to the release you generated in Creating a release, enter:

$ ucd badges add my_first_badge 80653663-eb39-45e7-9323-e34b23df0d75
Added badge 'my_first_badge' to release (80653663-eb39-45e7-9323-e34b23df0d75).

To list all the badges you applied in this bucket:

$ ucd badges list
Badges for current bucket (aee9ee5f-fa01-46d3-a293-731d15f066cf): 
  2020-01-07 12:55:41  my_first_badge  (80653663-eb39-45e7-9323-e34b23df0d75)

The content associated with the release that the badge references is ready for download. You can do this in a similar way to downloading content directly by Entry ID.

To get the content for an entry, such as spaceshooterdata_starfield.bundle, by path, enter:

https://<project_guid>.client-api.unity3dusercontent.com/client_api/v1/buckets/aee9ee5f-fa01-46d3-a293-731d15f066cf/release_by_badge/my_first_badge/entry_by_path/content/?path=spaceshooterdata_starfield.bundle

Or to get the content of an entry by Entry ID, enter:

https://<project_guid>.client-api.unity3dusercontent.com/client_api/v1/buckets/aee9ee5f-fa01-46d3-a293-731d15f066cf/release_by_badge/my_first_badge/entries/8ac46783-be01-4a47-b23e-74233fc7cc09/content/

Unity CCD Develop Dashboard
Unity IAP
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961