docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Sample: Manage assets

    The sample available as part of the Unity Cloud Assets demonstrates how to update and publish assets. A typical example of audience for this guide is the developers who want to integrate asset management features in their app.

    The sample use the management endpoints that requires a minimum role of:

    • Asset Management Contributor.
      OR
    • Organization Owner.

    Before you start

    To use the Asset Management sample, you need the following:

    • Installed Assets package
    • Installed Identity package
    • A valid Unity ID Account
    • Access to your Unity Gaming Services account
    • An access to the Asset Manager service
    • A Unity Project with the Asset Manager service enabled, see: Asset Manager documentation
    Note

    While the Assets package doesn't depend on the Identity service, it is used in the sample to control the authentication process.

    Install the sample

    To install the sample, follow these steps:

    1. Inside your Unity Project window, go to Package Manager > Unity Cloud Assets.
    2. Expand the Samples section.
    3. On the right of the Asset Management sample, select Import.
      Screenshot of the samples import section of the package manager window

    After the import process completes, you can view the imported assets in the Unity Cloud Assets/Samples/Samples/Asset Management folder.
    Screenshot of the imported sample

    Run the sample

    To run the sample, follow these steps:

    1. Go to Assets/Samples/Unity Cloud Assets/<package-version>/Asset Management/Scenes/AssetManagerSample.unity and run the scene.
    2. Select an Organization. The list of Projects from that Organization appears on the left column.
      Screenshot of the organization selection
    3. Select a Project. The list of assets from that Project appears on the right column.
      Screenshot of the project list
      Screenshot of the assets grid

    Search for specific assets

    To search for specific assets by tag or name in this sample, follow these steps:

    1. Select a Project.
    2. In the search bar, type the keywords by which you want to search your assets and select Search.
      Screenshot of the created topic
    Note

    While using the SDK, you will be able to build different and more complex queries. For more information on asset search, see the Search Assets use case.

    Search prompts

    As you type in the search bar, the sample will display a list of keyword suggestions based on your search. These keywords are aggregated from the tags and names of your assets. To select a keyword, select it. The search bar will add it as a parameter and the sample will refresh the asset list to match the new search.

    Update/edit an asset

    To update an asset in this sample, follow these steps:

    1. Select a Project.
    2. On the right side of the screen, select ... button of the asset you want to update and select Open.
      Screenshot of the open button
    3. In the asset details page, edit the asset's information and select the Save asset button. Add metadata to the asset by selecting the Add Metadata button.
      Screenshot of the asset edit panel
    4. To add a new dataset to the asset, select the Create dataset button.
      Screenshot of the add dataset button
    5. A new dataset with an automatic name is added to the asset.
      Screenshot of the new created dataset in list
    6. To update a dataset or manage the files of an asset, you can select the desired dataset.
      Screenshot of the dataset in list
    7. In the dataset details page, edit the dataset's information and select the Save dataset button.
      Screenshot of the dataset panel
    8. In the dataset details page, you can start a workflow to generate a thumbnail by selecting the Generate preview button. This will create a new dataset containing an image file.
    9. To add a new file to the dataset, select the Browse button, select the desired file. If a dataset possesses at least one file, you can generate a preview image by selecting Generate Preview button.
      Screenshot of the browse button
    10. To remove a file from the dataset, select the Trash icon button.
      Screenshot of the remove button
    11. To go back to the detail of the asset, select the Back button on the top left corner.
    12. To go back to the list of assets of the Project, select the Back button on the top left corner.
    Note

    When an asset is not published, you can do the two following actions :

    1. You can save the asset by selecting the Save asset button.

    Screenshot of the save asset button

    1. You can publish it by checking the Publish checkbox and selecting the Publish asset button.

    Screenshot of the publish asset button

    1. Sources dataset is the default dataset of an asset used to list the asset data files.
    2. Previews dataset is default dataset of an asset to list the asset preview files.

    Main components

    This section describes the scripts that make up the main components of the Asset Management sample.

    Platform services script

    The PlatformServices class initializes and disposes of dependencies required by the IAssetRepository. You can use this class to manage the Unity Cloud services and dependencies you use 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.

    The PlatformServices class has two accompanying classes called PlatformServicesInitialization and PlatformServicesShutdown that call the initialization and shutdown methods through Unity's standard Monobehaviour methods Awake(), Start() and OnDestroy().

    Project controller script

    The ProjectController class inherits from the OrganizationController class which makes it so you can sign into your application and uses your ID to grant access to the Asset Management sample. For more information on authentication, see the Get user information use case in the Identity package documentation. The ProjectController class uses the IOrganizationRepository of the PlatformServices to retrieve the list of organizations you have access to. The ProjectController class also uses the IAssetRepository of the PlatformServices to retrieve the list of projects you have access to 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 Management sample script

    The AssetManagerSample 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 assets from the Asset Manager service and manage them
    • Search for assets by tag or name

    To open the Asset Management sample script, go to your Assets/Samples/Unity Cloud Assets/<package-version>/AssetManager/Scripts/AssetManagerSample.cs file.

    Shared UI scripts

    The UI sample includes a set of UI scripts and prefabs used by Unity Cloud Assets samples. To open shared UI scripts, go to Assets/Samples/Unity Cloud Assets/<package-version>/Shared/Scripts/Controllers.

    Troubleshooting

    Refer to the troubleshooting section for help with sample issues.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)