docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Sample: Discover assets

    You can use the Asset Discovery sample to search and download assets from your Organizations and Projects.

    You can use the Unity Cloud Assets package to filter assets in a Project based on a set of search criteria. You will need at least a Consumer Role to be able to download assets

    Organization or Asset Manager Project role Search Download
    Asset Management Viewer yes No
    Asset Management Consumer yes yes
    Asset Management Contributor yes yes
    Organization Owner yes yes

    Before you start

    Before you use the Asset Discovery sample, you must have the following:

    • Installed Assets package
    • Installed Identity package
    • A valid Unity ID Account
    • Access to your Unity Gaming Services account
    • Access to Asset Manager service
    • At least one asset in an Asset Management Project, see: Asset Manager documentation
    • 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.

    Known limitations

    The Asset Discovery sample has the following limitations:

    • Projects and organizations with a large number of assets may experience performance issues. When building the sample as a standalone application, the application may crash due to memory limitations.

    Install the sample

    To install the sample, follow these steps:

    1. In your Unity Project window, go to Package Manager > Unity Cloud Assets.

    2. Expand the Samples section.

    3. On the right of the Asset Discovery sample, select Import.

      Screenshot of the samples import section of the package manager window

    4. After the import process completes, you can view the imported sample in the Assets/Samples/Unity Cloud Assets 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 Discovery/Scenes/AssetDiscoverySample.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 login window

    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 manual.

    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.

    See asset details and download files

    To see your asset information in this sample, select one of the assets in the grid. The asset details view appears.
    Screenshot of the created topic

    The details view shows you the following information about your asset:

    • Name
    • Description
    • Tags
    • System tags
    • Collections
    • Creation and last edit dates
    • Name of users who created and last edited the asset
    • Metadata

    To download your asset information in this sample, follow these steps:

    1. Select one of the assets in the grid. The asset details view appears.
    2. In the details view, select Download.
    3. A prompt appears to confirm the download location. Select Ok to download the asset.
    Note

    To download assets, you need the right permissions in your Project to consume assets. Refer to the the Asset Manager documentation for more information on permissions.

    Main components

    This section describes the scripts that make up the main components of the Asset Discovery 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 enables signing into your application and uses your ID to grant access to the Asset Discovery 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 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 Discovery sample script

    The AssetDiscoverySample shows you how to do the following:

    • Integrate the login flow with the ProjectController class.
    • Retrieve Organizations and Projects from the Assets service.
    • Retrieve assets from the Assets service.
    • Search for assets by tag or name.

    To open the Asset Discovery sample script, go to your Assets/Samples/Unity Cloud Assets/<package-version>/AssetDiscovery/Scripts/AssetDiscoverySample.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.

    Go further with your sample

    This section describes other actions you can perform with the Asset Discovery sample.

    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)