| Parameter | Description |
|---|---|
| guid | The GUID of the asset, as a string. |
string The project-relative path of the asset, or an empty string if no asset has the GUID.
Gets the path of the asset with a GUID in string form, relative to the project folder.
Use this method to find where an asset is stored when you have its GUID. Paths are relative to the project folder, for example Assets/MyTextures/hello.png. To get the GUID of an asset as a string, use AssetDatabase.AssetPathToGUID.
using UnityEditor; using UnityEngine;
public class GUIDToAssetPathExample : MonoBehaviour { [MenuItem("APIExamples/GUIDToAssetPath")] static void MaterialPathsInProject() { var allMaterials = AssetDatabase.FindAssets("t: Material");
foreach (var guid in allMaterials) { var path = AssetDatabase.GUIDToAssetPath(guid); Debug.Log(path); } } }
| Parameter | Description |
|---|---|
| guid | The GUID of the asset. |
string The project-relative path of the asset, or an empty string if no asset has the GUID.
Gets the path of the asset with the specified GUID, relative to the project folder.
Use this method to find where an asset is stored when you have its GUID. Paths are relative to the project folder, for example Assets/MyTextures/hello.png. To get the GUID of an asset, use AssetDatabase.GUIDFromAssetPath.