Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetAssetByGUID(string)

Returns version control information about an asset from a given GUID.
Read time 1 minuteLast updated 10 days ago

Definition

public static Asset GetAssetByGUID(string guid)

Parameters

guid

GUID of asset.

Returns

Type

Description

Asset

Remarks

Returns null if the GUID is not known by the Unity Editor.

Examples

using System.Collections.Generic;using UnityEditor;using UnityEditor.VersionControl;using UnityEngine;public class EditorScript : MonoBehaviour{ [MenuItem("Version Control/GetAssetByGUID")] static void ExampleGetAssetByGUID() { string guid = AssetDatabase.AssetPathToGUID("Assets/ExampleAsset.mat"); AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByGUID(guid)); Debug.Log("Found an asset: " + assets[0].name.ToString()); }}