Sample: Manage asset collections
Use the Collection Management sample to list and manage the collections of assets in your projects.
Note
To manage assets, you need the Asset Manager Admin
role at the organization level or the Asset Manager Contributor
add-on role at the project level. Asset Manager Contributors can manage assets only for the specific projects to which they have access.
Before you start
Before you use the Collection Management sample, make sure you have the following:
- An installed Assets package.
- An installed Identity package.
- A valid Unity ID Account.
- Access to your Unity Gaming Services account.
- A Unity Project with the Asset Manager service enabled. Read more about creating a Unity project.
- Access to the Asset Manager service.
- At least one published asset in an Asset Manager project. Read more about adding assets using the Asset SDK and adding a single asset or multiple assets through the dashboard.
Note
Although the Assets package does not depend on the Identity service, the sample uses the service to control the authentication process.
Install the sample
To install the sample, follow these steps:
Open your application project in the Unity Editor.
Go to Window > Package Manager > Unity Cloud Assets.
Expand the Samples section.
Next to
Collection Management
, select Import.After the import process completes, the sample displays under the
Assets/Samples/Unity Cloud Assets
folder.

Run the sample
To run the sample, follow these steps:
Go to
Assets/Samples/Unity Cloud Assets/<package-version>/Asset Collection Management/Scenes/CollectionManagementSample.unity
and run the scene.Select an organization to display the list of projects in the selected organization on the left panel.
Select a project to display the list of collections in the selected project on the middle panel.
Select a collection to display the list of assets in the selected collection on the right panel.
Create a new collection
To create a new collection, follow these steps:
Next to
Collections
, select the ellipsis button (…).Select Create.
Enter a name and a description for the collection.
Optionally, enter a parent path.
Select Create.
Edit an existing collection
To edit an existing collection, follow these steps:
Select a collection in the list.
Next to
Collections
, select the ellipsis button (…).Select Edit.
Enter a new name and a new description for the collection.
Select Apply.
Delete an existing collection
To delete an existing collection, follow these steps:
Select a collection in the list.
Next to
Collections
, select the ellipsis button (…).Select Delete.
Add assets to a collection
To add an asset to a collection, follow these steps:
Select a collection in the list.
Next to
Assets in Collection
, select the ellipsis button (…).Select Add.
Select all the assets you want to add to the collection.
Select Add.
Remove assets from a collection
To remove an asset from a collection, follow these steps:
Select an asset in the list.
Next to
Assets in Collection
, select the ellipsis button (…).Select Remove.
Main components
This section describes the scripts that make up the main components of the Asset Collection Management sample.
Platform services script
The PlatformServices
class handles the initialization and disposal of dependencies necessary for the IAssetRepository
interface. Use this class to manage the Unity Cloud services and dependencies in your application.
To open the platform services script, go to your Assets/Samples/Unity Cloud Assets/<package-version>/Shared/Scripts/Services/PlatformServices.cs
file.
Use the following classes with the PlatformServices
class:
PlatformServicesInitialization
PlatformServicesShutdown
These classes use the following standard Unity Monobehaviour
methods to run the initialization and shutdown methods:
Awake()
Start()
OnDestroy()
Project controller script
The ProjectController
class inherits the following from the OrganizationController
class:
- Sign in to your application.
- Use your ID to grant access to the Collection Management sample.
Read more about authentication.
The ProjectController
class uses the IOrganizationRepository
interface of the PlatformServices
class to retrieve the list of organizations you have access to.
The ProjectController
class uses the IAssetRepository
interface of the PlatformServices
class to retrieve the list of your projects for the selected organization.
To open the project controller script, go to your Assets/Samples/Unity Cloud Assets/<package-version>/Shared/Scripts/Controllers/ProjectController.cs
file.
Asset collection management sample script
The CollectionManagementSample
shows you how to do the following:
- Integrate the login flow with the
ProjectController
class. - Retrieve organizations and projects from the Asset Manager service.
- Retrieve published assets from the Asset Manager service.
- Search for assets by tag or name.
To open the Collection Management sample script, go to your Assets/Samples/Unity Cloud Assets/<package-version>/Asset Collection Management/Scripts/CollectionManagementSample.cs
file.
Collection list, asset list, and collection asset list UI scripts
- The
CollectionListUi
,AssetListUi
, andCollectionAssetListUi
classes list the assets, collections, and assets belonging to a collection in the sample. - The
AssetPanelUi
class bridges data betweenAssetListUi
andCollectionAssetListUi
.
Shared UI scripts
The UI
sample includes a set of UI scripts and prefabs that Unity Cloud Assets samples use. To open shared UI scripts, go to Assets/Samples/Unity Cloud Assets/<package-version>/Shared/Scripts/Controllers
.
Troubleshooting
In case of issues with samples, refer to troubleshooting.