Manage asset versions
How to manage asset versions and version labels
Read time 2 minutesLast updated 5 months ago
Before you begin
To access any assets, make sure the app has the right permissions. Read more about managing Identity.Submit or freeze an asset version
When you see an asset version as complete, to freeze a specific version, callfreeze_asset_versionunity_cloud.assets.freeze_asset_version( org_id = "012345678912", project_id = "1234abcd-ab12-cd34-ef56-123456abcdef", asset_id = "0123456789abcdefghijklmn", asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef', changelog = "Initial version")
Create a new unfrozen version
To create a new unfrozen version from a frozen version, callcreate_unfrozen_asset_versionnew_version = unity_cloud.assets.create_unfrozen_asset_version( org_id = "012345678912", project_id = "1234abcd-ab12-cd34-ef56-123456abcdef", asset_id = "0123456789abcdefghijklmn", asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef')
Search for versions of assets
To search for a version of an asset, follow these steps:- Create your filters as dictionaries or objects that will contain the conditions.
- Create an array that will contain the collections in which to look up. Leave the array empty to search across all collections and assets version not linked to a collection.
- Call with the organization ID, your project IDs, your filters, the amount of matches required in
search_versions_in_asset, the collections, and optionally the maximum number of results returned and the amount to skip for paging purpose.any_filter
include_filter = dict() exclude_filter = dict() any_filter = dict() include_filter[SearchableProperties.NAME] = StringFilter(StringLookUpTypes.REGEX, "asset\-.*") collections = [] search_result = unity_cloud.assets.search_versions_in_asset(org_id, project_id, asset_id, include_filter=include_filter, exclude_filter=exclude_filter, any_filter=any_filter, any_query_minimum_match=1, collections=collections, limit_to=10, skip=0)
Create a version label
To create a version label, follow these steps:- Create a object by passing the name, the description, and the color in hex code that it will display in the dashboard.
LabelCreation - Call with the organization id and the previously created
create_label.LabelCreation
label_creation = LabelCreation(name="my new version label", description="label_description", color="#FFFFFF") label = unity_cloud.assets.create_label(org_id="1234567890", label=label_creation)
Update a version label
To update a version label, follow these steps:- Create a object and pass the name, the new description, and the new color in hex code that will display in the dashboard.
LabelUpdate - Call with the organization id and the previously created
update_label.LabelUpdate
label_update = LabelUpdate(name=label.name, description= "new description", color="#000000") unity_cloud.assets.update_label(org_id="1234567890", label=label_update)
Get a version label
To get a single version label, callget_labellabel = unity_cloud.assets.get_label(org_id="1234567890", name="the name")
List all version labels in an organization
To list all created version labels in an organization, calllist_organization_labelslabels = unity_cloud.assets.list_organization_labels(org_id="1234567890", is_archived=False)
Archive or unarchive a version label
To archive or unarchive a version label, callarchive_labelunarchive_labelunity_cloud.assets.archive_label(org_id="1234567890", name="label name") unity_cloud.assets.unarchive_label(org_id="1234567890", name="label name")
Assign or unassign version labels to an asset version
Once version labels are created, to assign or unassign them to a specific asset version, callassign_labelsunassign_labelsunity_cloud.assets.assign_labels( org_id = "012345678912", project_id = "1234abcd-ab12-cd34-ef56-123456abcdef", asset_id = "0123456789abcdefghijklmn", asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef', labels = ["label1", "label2"]) unity_cloud.assets.unassign_labels( org_id = "012345678912", project_id = "1234abcd-ab12-cd34-ef56-123456abcdef", asset_id = "0123456789abcdefghijklmn", asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef', labels = ["label1", "label2"])
List the version labels assigned to an asset version
Once labels have been assigned to an asset version, to list them, calllist_asset_labelsasset_labels_names = unity_cloud.assets.list_asset_labels( org_id = "012345678912", project_id = "1234abcd-ab12-cd34-ef56-123456abcdef", asset_id = "0123456789abcdefghijklmn", asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef', is_archived = false, limit = 100, skip = 0 )