Use case: Search assets across projects
You can use the Unity Cloud Assets package to filter assets across projects based on a set of search criteria.
| Organization or Asset Manager Project role | Cross-project search |
|---|---|
Asset Management Viewer |
yes |
Asset Management Consumer |
yes |
Asset Management Contributor |
yes |
Organization Owner |
yes |
Methodology
To search assets across projects, you can use the QueryAssets method of an IAssetRepository, like so:
IAsyncEnumerable<IAsset> SearchAsync(IEnumerable<ProjectDescriptor> projectDescriptors, IAssetSearchFilter searchFilter)
{
return m_AssetRepository.QueryAssets(projectDescriptors)
.SelectWhereMatchesFilter(searchFilter)
.ExecuteAsync(CancellationToken.None);
}
The ExecuteAsync method returns an awaitable IAsyncEnumerable that will return each IAsset result.
Built-in Search Filter
For more information on the IAssetSearchFilter, see Use case: Search assets in a project.